aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/backend.c6
-rw-r--r--backend/drm/drm.c9
-rw-r--r--backend/headless/backend.c4
-rw-r--r--backend/headless/input_device.c3
-rw-r--r--backend/headless/output.c2
-rw-r--r--backend/libinput/backend.c1
-rw-r--r--backend/libinput/events.c11
-rw-r--r--backend/multi/backend.c61
-rw-r--r--backend/wayland/output.c2
-rw-r--r--backend/wayland/wl_seat.c9
-rw-r--r--backend/x11/backend.c10
11 files changed, 44 insertions, 74 deletions
diff --git a/backend/backend.c b/backend/backend.c
index 98b94c5c..aec5781e 100644
--- a/backend/backend.c
+++ b/backend/backend.c
@@ -19,10 +19,8 @@ void wlr_backend_init(struct wlr_backend *backend,
assert(backend);
backend->impl = impl;
wl_signal_init(&backend->events.destroy);
- wl_signal_init(&backend->events.input_add);
- wl_signal_init(&backend->events.input_remove);
- wl_signal_init(&backend->events.output_add);
- wl_signal_init(&backend->events.output_remove);
+ wl_signal_init(&backend->events.new_input);
+ wl_signal_init(&backend->events.new_output);
}
bool wlr_backend_start(struct wlr_backend *backend) {
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 516eb405..7af242bc 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -871,7 +871,8 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) {
wlr_conn->state = WLR_DRM_CONN_NEEDS_MODESET;
wlr_log(L_INFO, "Sending modesetting signal for '%s'",
wlr_conn->output.name);
- wlr_signal_emit_safe(&drm->backend.events.output_add, &wlr_conn->output);
+ wlr_signal_emit_safe(&drm->backend.events.new_output,
+ &wlr_conn->output);
} else if (wlr_conn->state == WLR_DRM_CONN_CONNECTED &&
drm_conn->connection != DRM_MODE_CONNECTED) {
wlr_log(L_INFO, "'%s' disconnected", wlr_conn->output.name);
@@ -979,8 +980,6 @@ void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) {
return;
}
- struct wlr_drm_backend *drm = (struct wlr_drm_backend *)conn->output.backend;
-
switch (conn->state) {
case WLR_DRM_CONN_CONNECTED:
case WLR_DRM_CONN_CLEANUP:;
@@ -1014,8 +1013,8 @@ void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) {
/* Fallthrough */
case WLR_DRM_CONN_NEEDS_MODESET:
wlr_log(L_INFO, "Emitting destruction signal for '%s'",
- conn->output.name);
- wlr_signal_emit_safe(&drm->backend.events.output_remove, &conn->output);
+ conn->output.name);
+ wlr_signal_emit_safe(&conn->output.events.destroy, &conn->output);
break;
case WLR_DRM_CONN_DISCONNECTED:
break;
diff --git a/backend/headless/backend.c b/backend/headless/backend.c
index 7832b00c..703dc8cd 100644
--- a/backend/headless/backend.c
+++ b/backend/headless/backend.c
@@ -17,14 +17,14 @@ static bool backend_start(struct wlr_backend *wlr_backend) {
wl_list_for_each(output, &backend->outputs, link) {
wl_event_source_timer_update(output->frame_timer, output->frame_delay);
wlr_output_update_enabled(&output->wlr_output, true);
- wlr_signal_emit_safe(&backend->backend.events.output_add,
+ wlr_signal_emit_safe(&backend->backend.events.new_output,
&output->wlr_output);
}
struct wlr_headless_input_device *input_device;
wl_list_for_each(input_device, &backend->input_devices,
wlr_input_device.link) {
- wlr_signal_emit_safe(&backend->backend.events.input_add,
+ wlr_signal_emit_safe(&backend->backend.events.new_input,
&input_device->wlr_input_device);
}
diff --git a/backend/headless/input_device.c b/backend/headless/input_device.c
index 68e7ce24..6b2bc4e7 100644
--- a/backend/headless/input_device.c
+++ b/backend/headless/input_device.c
@@ -12,7 +12,6 @@
static void input_device_destroy(struct wlr_input_device *wlr_dev) {
struct wlr_headless_input_device *device =
(struct wlr_headless_input_device *)wlr_dev;
- wlr_signal_emit_safe(&device->backend->backend.events.input_remove, wlr_dev);
free(device);
}
@@ -89,7 +88,7 @@ struct wlr_input_device *wlr_headless_add_input_device(
wl_list_insert(&backend->input_devices, &wlr_device->link);
if (backend->started) {
- wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_device);
+ wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_device);
}
return wlr_device;
diff --git a/backend/headless/output.c b/backend/headless/output.c
index eab983cc..f31b7d37 100644
--- a/backend/headless/output.c
+++ b/backend/headless/output.c
@@ -137,7 +137,7 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend,
if (backend->started) {
wl_event_source_timer_update(output->frame_timer, output->frame_delay);
wlr_output_update_enabled(wlr_output, true);
- wlr_signal_emit_safe(&backend->backend.events.output_add, wlr_output);
+ wlr_signal_emit_safe(&backend->backend.events.new_output, wlr_output);
}
return wlr_output;
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c
index dfbe1d20..5b815a0c 100644
--- a/backend/libinput/backend.c
+++ b/backend/libinput/backend.c
@@ -107,7 +107,6 @@ static void wlr_libinput_backend_destroy(struct wlr_backend *wlr_backend) {
struct wl_list *wlr_devices = backend->wlr_device_lists.items[i];
struct wlr_input_device *wlr_dev, *next;
wl_list_for_each_safe(wlr_dev, next, wlr_devices, link) {
- wlr_signal_emit_safe(&backend->backend.events.input_remove, wlr_dev);
wlr_input_device_destroy(wlr_dev);
}
free(wlr_devices);
diff --git a/backend/libinput/events.c b/backend/libinput/events.c
index 60088a40..4bcfa539 100644
--- a/backend/libinput/events.c
+++ b/backend/libinput/events.c
@@ -89,7 +89,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
free(wlr_dev);
goto fail;
}
- wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev);
+ wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev);
}
if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_POINTER)) {
struct wlr_input_device *wlr_dev = allocate_device(backend,
@@ -102,7 +102,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
free(wlr_dev);
goto fail;
}
- wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev);
+ wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev);
}
if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_TOUCH)) {
struct wlr_input_device *wlr_dev = allocate_device(backend,
@@ -115,7 +115,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
free(wlr_dev);
goto fail;
}
- wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev);
+ wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev);
}
if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_TABLET_TOOL)) {
struct wlr_input_device *wlr_dev = allocate_device(backend,
@@ -128,7 +128,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
free(wlr_dev);
goto fail;
}
- wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev);
+ wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev);
}
if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_TABLET_PAD)) {
struct wlr_input_device *wlr_dev = allocate_device(backend,
@@ -141,7 +141,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
free(wlr_dev);
goto fail;
}
- wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev);
+ wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev);
}
if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_GESTURE)) {
// TODO
@@ -179,7 +179,6 @@ static void handle_device_removed(struct wlr_libinput_backend *backend,
}
struct wlr_input_device *dev, *tmp_dev;
wl_list_for_each_safe(dev, tmp_dev, wlr_devices, link) {
- wlr_signal_emit_safe(&backend->backend.events.input_remove, dev);
wlr_input_device_destroy(dev);
}
for (size_t i = 0; i < backend->wlr_device_lists.length; i++) {
diff --git a/backend/multi/backend.c b/backend/multi/backend.c
index 14f774d0..02738f59 100644
--- a/backend/multi/backend.c
+++ b/backend/multi/backend.c
@@ -11,11 +11,9 @@
struct subbackend_state {
struct wlr_backend *backend;
struct wlr_backend *container;
- struct wl_listener input_add;
- struct wl_listener input_remove;
- struct wl_listener output_add;
- struct wl_listener output_remove;
- struct wl_listener backend_destroy;
+ struct wl_listener new_input;
+ struct wl_listener new_output;
+ struct wl_listener destroy;
struct wl_list link;
};
@@ -32,11 +30,9 @@ static bool multi_backend_start(struct wlr_backend *wlr_backend) {
}
static void subbackend_state_destroy(struct subbackend_state *sub) {
- wl_list_remove(&sub->input_add.link);
- wl_list_remove(&sub->input_remove.link);
- wl_list_remove(&sub->output_add.link);
- wl_list_remove(&sub->output_remove.link);
- wl_list_remove(&sub->backend_destroy.link);
+ wl_list_remove(&sub->new_input.link);
+ wl_list_remove(&sub->new_output.link);
+ wl_list_remove(&sub->destroy.link);
wl_list_remove(&sub->link);
free(sub);
}
@@ -118,34 +114,21 @@ bool wlr_backend_is_multi(struct wlr_backend *b) {
return b->impl == &backend_impl;
}
-static void input_add_reemit(struct wl_listener *listener, void *data) {
+static void new_input_reemit(struct wl_listener *listener, void *data) {
struct subbackend_state *state = wl_container_of(listener,
- state, input_add);
- wlr_signal_emit_safe(&state->container->events.input_add, data);
+ state, new_input);
+ wlr_signal_emit_safe(&state->container->events.new_input, data);
}
-static void input_remove_reemit(struct wl_listener *listener, void *data) {
+static void new_output_reemit(struct wl_listener *listener, void *data) {
struct subbackend_state *state = wl_container_of(listener,
- state, input_remove);
- wlr_signal_emit_safe(&state->container->events.input_remove, data);
-}
-
-static void output_add_reemit(struct wl_listener *listener, void *data) {
- struct subbackend_state *state = wl_container_of(listener,
- state, output_add);
- wlr_signal_emit_safe(&state->container->events.output_add, data);
-}
-
-static void output_remove_reemit(struct wl_listener *listener, void *data) {
- struct subbackend_state *state = wl_container_of(listener,
- state, output_remove);
- wlr_signal_emit_safe(&state->container->events.output_remove, data);
+ state, new_output);
+ wlr_signal_emit_safe(&state->container->events.new_output, data);
}
static void handle_subbackend_destroy(struct wl_listener *listener,
void *data) {
- struct subbackend_state *state = wl_container_of(listener,
- state, backend_destroy);
+ struct subbackend_state *state = wl_container_of(listener, state, destroy);
subbackend_state_destroy(state);
}
@@ -180,20 +163,14 @@ void wlr_multi_backend_add(struct wlr_backend *_multi,
sub->backend = backend;
sub->container = &multi->backend;
- wl_signal_add(&backend->events.destroy, &sub->backend_destroy);
- sub->backend_destroy.notify = handle_subbackend_destroy;
-
- wl_signal_add(&backend->events.input_add, &sub->input_add);
- sub->input_add.notify = input_add_reemit;
-
- wl_signal_add(&backend->events.input_remove, &sub->input_remove);
- sub->input_remove.notify = input_remove_reemit;
+ wl_signal_add(&backend->events.destroy, &sub->destroy);
+ sub->destroy.notify = handle_subbackend_destroy;
- wl_signal_add(&backend->events.output_add, &sub->output_add);
- sub->output_add.notify = output_add_reemit;
+ wl_signal_add(&backend->events.new_input, &sub->new_input);
+ sub->new_input.notify = new_input_reemit;
- wl_signal_add(&backend->events.output_remove, &sub->output_remove);
- sub->output_remove.notify = output_remove_reemit;
+ wl_signal_add(&backend->events.new_output, &sub->new_output);
+ sub->new_output.notify = new_output_reemit;
wlr_signal_emit_safe(&multi->events.backend_add, backend);
}
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index f2336549..b1cc6836 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -339,7 +339,7 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) {
wl_list_insert(&backend->outputs, &output->link);
wlr_output_update_enabled(wlr_output, true);
- wlr_signal_emit_safe(&backend->backend.events.output_add, wlr_output);
+ wlr_signal_emit_safe(&backend->backend.events.new_output, wlr_output);
return wlr_output;
error:
diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c
index 2018f449..18114119 100644
--- a/backend/wayland/wl_seat.c
+++ b/backend/wayland/wl_seat.c
@@ -193,9 +193,8 @@ static struct wl_keyboard_listener keyboard_listener = {
.repeat_info = keyboard_handle_repeat_info
};
-static void input_device_destroy(struct wlr_input_device *_dev) {
- struct wlr_wl_input_device *dev = (struct wlr_wl_input_device *)_dev;
- wlr_signal_emit_safe(&dev->backend->backend.events.input_remove, &dev->wlr_input_device);
+static void input_device_destroy(struct wlr_input_device *wlr_dev) {
+ struct wlr_wl_input_device *dev = (struct wlr_wl_input_device *)wlr_dev;
if (dev->resource) {
wl_proxy_destroy(dev->resource);
}
@@ -257,7 +256,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
wlr_device->pointer = &wlr_wl_pointer->wlr_pointer;
wlr_pointer_init(wlr_device->pointer, NULL);
wlr_wl_device->resource = wl_pointer;
- wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_device);
+ wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_device);
backend->pointer = wl_pointer;
}
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD)) {
@@ -281,7 +280,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
struct wl_keyboard *wl_keyboard = wl_seat_get_keyboard(wl_seat);
wl_keyboard_add_listener(wl_keyboard, &keyboard_listener, wlr_device);
wlr_wl_device->resource = wl_keyboard;
- wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_device);
+ wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_device);
}
}
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index 2417810a..5608a2ea 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -230,9 +230,9 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) {
xcb_flush(x11->xcb_conn);
wlr_output_update_enabled(&output->wlr_output, true);
- wlr_signal_emit_safe(&x11->backend.events.output_add, output);
- wlr_signal_emit_safe(&x11->backend.events.input_add, &x11->keyboard_dev);
- wlr_signal_emit_safe(&x11->backend.events.input_add, &x11->pointer_dev);
+ wlr_signal_emit_safe(&x11->backend.events.new_output, output);
+ wlr_signal_emit_safe(&x11->backend.events.new_input, &x11->keyboard_dev);
+ wlr_signal_emit_safe(&x11->backend.events.new_input, &x11->pointer_dev);
wl_event_source_timer_update(x11->frame_timer, 16);
@@ -249,8 +249,8 @@ static void wlr_x11_backend_destroy(struct wlr_backend *backend) {
struct wlr_x11_output *output = &x11->output;
wlr_output_destroy(&output->wlr_output);
- wlr_signal_emit_safe(&backend->events.input_remove, &x11->pointer_dev);
- wlr_signal_emit_safe(&backend->events.input_remove, &x11->keyboard_dev);
+ wlr_signal_emit_safe(&x11->pointer_dev.events.destroy, &x11->pointer_dev);
+ wlr_signal_emit_safe(&x11->keyboard_dev.events.destroy, &x11->keyboard_dev);
// TODO probably need to use wlr_keyboard_destroy, but the devices need to
// be malloced for that to work
if (x11->keyboard_dev.keyboard->keymap) {