diff options
author | emersion <contact@emersion.fr> | 2018-02-12 09:12:31 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-02-12 09:12:31 +0100 |
commit | 5e58d46cc1a90810e3ee76203cee8ca2f14fb462 (patch) | |
tree | a5019d87cdc121842ab7cf867fbcac0fde4ccff0 /backend | |
parent | 3497e53516d96ad67b26115e2e06218f68e1114d (diff) |
Add wlr_signal_emit_safe
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/backend.c | 3 | ||||
-rw-r--r-- | backend/drm/drm.c | 5 | ||||
-rw-r--r-- | backend/headless/backend.c | 7 | ||||
-rw-r--r-- | backend/headless/input_device.c | 5 | ||||
-rw-r--r-- | backend/headless/output.c | 3 | ||||
-rw-r--r-- | backend/libinput/backend.c | 5 | ||||
-rw-r--r-- | backend/libinput/events.c | 13 | ||||
-rw-r--r-- | backend/libinput/pointer.c | 9 | ||||
-rw-r--r-- | backend/libinput/tablet_pad.c | 7 | ||||
-rw-r--r-- | backend/libinput/tablet_tool.c | 9 | ||||
-rw-r--r-- | backend/libinput/touch.c | 9 | ||||
-rw-r--r-- | backend/multi/backend.c | 15 | ||||
-rw-r--r-- | backend/session/direct-freebsd.c | 5 | ||||
-rw-r--r-- | backend/session/direct.c | 5 | ||||
-rw-r--r-- | backend/session/logind.c | 7 | ||||
-rw-r--r-- | backend/session/session.c | 3 | ||||
-rw-r--r-- | backend/wayland/backend.c | 3 | ||||
-rw-r--r-- | backend/wayland/output.c | 3 | ||||
-rw-r--r-- | backend/wayland/wl_seat.c | 13 | ||||
-rw-r--r-- | backend/x11/backend.c | 21 |
20 files changed, 85 insertions, 65 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 3782817c..4d09e078 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -11,6 +11,7 @@ #include <wlr/interfaces/wlr_output.h> #include <wlr/types/wlr_list.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include <wlr/render/egl.h> #include "backend/drm/drm.h" @@ -34,7 +35,7 @@ static void wlr_drm_backend_destroy(struct wlr_backend *backend) { wlr_output_destroy(&conn->output); } - wl_signal_emit(&backend->events.destroy, backend); + wlr_signal_emit_safe(&backend->events.destroy, backend); wl_list_remove(&drm->display_destroy.link); wl_list_remove(&drm->session_signal.link); diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 56a78851..516eb405 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -18,6 +18,7 @@ #include <wlr/backend/interface.h> #include <wlr/interfaces/wlr_output.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include <wlr/render/matrix.h> #include <wlr/render/gles2.h> #include <wlr/render.h> @@ -870,7 +871,7 @@ 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); - wl_signal_emit(&drm->backend.events.output_add, &wlr_conn->output); + wlr_signal_emit_safe(&drm->backend.events.output_add, &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); @@ -1014,7 +1015,7 @@ void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) { case WLR_DRM_CONN_NEEDS_MODESET: wlr_log(L_INFO, "Emitting destruction signal for '%s'", conn->output.name); - wl_signal_emit(&drm->backend.events.output_remove, &conn->output); + wlr_signal_emit_safe(&drm->backend.events.output_remove, &conn->output); break; case WLR_DRM_CONN_DISCONNECTED: break; diff --git a/backend/headless/backend.c b/backend/headless/backend.c index 0bf5ec28..7832b00c 100644 --- a/backend/headless/backend.c +++ b/backend/headless/backend.c @@ -2,6 +2,7 @@ #include <wlr/render/egl.h> #include <wlr/render/gles2.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include <wlr/interfaces/wlr_output.h> #include <wlr/interfaces/wlr_input_device.h> #include "backend/headless.h" @@ -16,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); - wl_signal_emit(&backend->backend.events.output_add, + wlr_signal_emit_safe(&backend->backend.events.output_add, &output->wlr_output); } struct wlr_headless_input_device *input_device; wl_list_for_each(input_device, &backend->input_devices, wlr_input_device.link) { - wl_signal_emit(&backend->backend.events.input_add, + wlr_signal_emit_safe(&backend->backend.events.input_add, &input_device->wlr_input_device); } @@ -51,7 +52,7 @@ static void backend_destroy(struct wlr_backend *wlr_backend) { wlr_input_device_destroy(&input_device->wlr_input_device); } - wl_signal_emit(&wlr_backend->events.destroy, backend); + wlr_signal_emit_safe(&wlr_backend->events.destroy, backend); wlr_egl_finish(&backend->egl); free(backend); diff --git a/backend/headless/input_device.c b/backend/headless/input_device.c index 5c62e87f..68e7ce24 100644 --- a/backend/headless/input_device.c +++ b/backend/headless/input_device.c @@ -6,12 +6,13 @@ #include <wlr/interfaces/wlr_tablet_tool.h> #include <wlr/interfaces/wlr_tablet_pad.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/headless.h" static void input_device_destroy(struct wlr_input_device *wlr_dev) { struct wlr_headless_input_device *device = (struct wlr_headless_input_device *)wlr_dev; - wl_signal_emit(&device->backend->backend.events.input_remove, wlr_dev); + wlr_signal_emit_safe(&device->backend->backend.events.input_remove, wlr_dev); free(device); } @@ -88,7 +89,7 @@ struct wlr_input_device *wlr_headless_add_input_device( wl_list_insert(&backend->input_devices, &wlr_device->link); if (backend->started) { - wl_signal_emit(&backend->backend.events.input_add, wlr_device); + wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_device); } return wlr_device; diff --git a/backend/headless/output.c b/backend/headless/output.c index 507595a5..eab983cc 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -4,6 +4,7 @@ #include <GLES2/gl2.h> #include <wlr/interfaces/wlr_output.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/headless.h" static EGLSurface egl_create_surface(struct wlr_egl *egl, unsigned int width, @@ -136,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); - wl_signal_emit(&backend->backend.events.output_add, wlr_output); + wlr_signal_emit_safe(&backend->backend.events.output_add, wlr_output); } return wlr_output; diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 86477947..dfbe1d20 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -4,6 +4,7 @@ #include <wlr/backend/session.h> #include <wlr/backend/interface.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/libinput.h" static int wlr_libinput_open_restricted(const char *path, @@ -106,13 +107,13 @@ 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) { - wl_signal_emit(&backend->backend.events.input_remove, wlr_dev); + wlr_signal_emit_safe(&backend->backend.events.input_remove, wlr_dev); wlr_input_device_destroy(wlr_dev); } free(wlr_devices); } - wl_signal_emit(&wlr_backend->events.destroy, wlr_backend); + wlr_signal_emit_safe(&wlr_backend->events.destroy, wlr_backend); wl_list_remove(&backend->display_destroy.link); wl_list_remove(&backend->session_signal.link); diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 758a9f25..60088a40 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -5,6 +5,7 @@ #include <wlr/interfaces/wlr_input_device.h> #include <wlr/util/log.h> #include <wayland-util.h> +#include <wlr/util/signal.h> #include "backend/libinput.h" struct wlr_input_device *get_appropriate_device( @@ -88,7 +89,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, free(wlr_dev); goto fail; } - wl_signal_emit(&backend->backend.events.input_add, wlr_dev); + wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev); } if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_POINTER)) { struct wlr_input_device *wlr_dev = allocate_device(backend, @@ -101,7 +102,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, free(wlr_dev); goto fail; } - wl_signal_emit(&backend->backend.events.input_add, wlr_dev); + wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev); } if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_TOUCH)) { struct wlr_input_device *wlr_dev = allocate_device(backend, @@ -114,7 +115,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, free(wlr_dev); goto fail; } - wl_signal_emit(&backend->backend.events.input_add, wlr_dev); + wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev); } if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_TABLET_TOOL)) { struct wlr_input_device *wlr_dev = allocate_device(backend, @@ -127,7 +128,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, free(wlr_dev); goto fail; } - wl_signal_emit(&backend->backend.events.input_add, wlr_dev); + wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev); } if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_TABLET_PAD)) { struct wlr_input_device *wlr_dev = allocate_device(backend, @@ -140,7 +141,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, free(wlr_dev); goto fail; } - wl_signal_emit(&backend->backend.events.input_add, wlr_dev); + wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev); } if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_GESTURE)) { // TODO @@ -178,7 +179,7 @@ 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) { - wl_signal_emit(&backend->backend.events.input_remove, dev); + 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/libinput/pointer.c b/backend/libinput/pointer.c index 13402ac2..f80f4f84 100644 --- a/backend/libinput/pointer.c +++ b/backend/libinput/pointer.c @@ -5,6 +5,7 @@ #include <wlr/types/wlr_input_device.h> #include <wlr/interfaces/wlr_pointer.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/libinput.h" struct wlr_pointer *wlr_libinput_pointer_create( @@ -35,7 +36,7 @@ void handle_pointer_motion(struct libinput_event *event, usec_to_msec(libinput_event_pointer_get_time_usec(pevent)); wlr_event.delta_x = libinput_event_pointer_get_dx(pevent); wlr_event.delta_y = libinput_event_pointer_get_dy(pevent); - wl_signal_emit(&wlr_dev->pointer->events.motion, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->pointer->events.motion, &wlr_event); } void handle_pointer_motion_abs(struct libinput_event *event, @@ -55,7 +56,7 @@ void handle_pointer_motion_abs(struct libinput_event *event, wlr_event.x_mm = libinput_event_pointer_get_absolute_x(pevent); wlr_event.y_mm = libinput_event_pointer_get_absolute_y(pevent); libinput_device_get_size(libinput_dev, &wlr_event.width_mm, &wlr_event.height_mm); - wl_signal_emit(&wlr_dev->pointer->events.motion_absolute, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->pointer->events.motion_absolute, &wlr_event); } void handle_pointer_button(struct libinput_event *event, @@ -81,7 +82,7 @@ void handle_pointer_button(struct libinput_event *event, wlr_event.state = WLR_BUTTON_RELEASED; break; } - wl_signal_emit(&wlr_dev->pointer->events.button, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->pointer->events.button, &wlr_event); } void handle_pointer_axis(struct libinput_event *event, @@ -128,7 +129,7 @@ void handle_pointer_axis(struct libinput_event *event, } wlr_event.delta = libinput_event_pointer_get_axis_value( pevent, axies[i]); - wl_signal_emit(&wlr_dev->pointer->events.axis, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->pointer->events.axis, &wlr_event); } } } diff --git a/backend/libinput/tablet_pad.c b/backend/libinput/tablet_pad.c index 7dac3b7c..54315581 100644 --- a/backend/libinput/tablet_pad.c +++ b/backend/libinput/tablet_pad.c @@ -5,6 +5,7 @@ #include <wlr/types/wlr_input_device.h> #include <wlr/interfaces/wlr_tablet_pad.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/libinput.h" struct wlr_tablet_pad *wlr_libinput_tablet_pad_create( @@ -41,7 +42,7 @@ void handle_tablet_pad_button(struct libinput_event *event, wlr_event.state = WLR_BUTTON_RELEASED; break; } - wl_signal_emit(&wlr_dev->tablet_pad->events.button, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->tablet_pad->events.button, &wlr_event); } void handle_tablet_pad_ring(struct libinput_event *event, @@ -67,7 +68,7 @@ void handle_tablet_pad_ring(struct libinput_event *event, wlr_event.source = WLR_TABLET_PAD_RING_SOURCE_FINGER; break; } - wl_signal_emit(&wlr_dev->tablet_pad->events.ring, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->tablet_pad->events.ring, &wlr_event); } void handle_tablet_pad_strip(struct libinput_event *event, @@ -93,5 +94,5 @@ void handle_tablet_pad_strip(struct libinput_event *event, wlr_event.source = WLR_TABLET_PAD_STRIP_SOURCE_FINGER; break; } - wl_signal_emit(&wlr_dev->tablet_pad->events.strip, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->tablet_pad->events.strip, &wlr_event); } diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index 3d5fafc3..2f28540b 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -5,6 +5,7 @@ #include <wlr/types/wlr_input_device.h> #include <wlr/interfaces/wlr_tablet_tool.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/libinput.h" struct wlr_tablet_tool *wlr_libinput_tablet_tool_create( @@ -72,7 +73,7 @@ void handle_tablet_tool_axis(struct libinput_event *event, } wlr_log(L_DEBUG, "Tablet tool axis event %d @ %f,%f", wlr_event.updated_axes, wlr_event.x_mm, wlr_event.y_mm); - wl_signal_emit(&wlr_dev->tablet_tool->events.axis, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->tablet_tool->events.axis, &wlr_event); } void handle_tablet_tool_proximity(struct libinput_event *event, @@ -98,7 +99,7 @@ void handle_tablet_tool_proximity(struct libinput_event *event, handle_tablet_tool_axis(event, libinput_dev); break; } - wl_signal_emit(&wlr_dev->tablet_tool->events.proximity, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->tablet_tool->events.proximity, &wlr_event); } void handle_tablet_tool_tip(struct libinput_event *event, @@ -124,7 +125,7 @@ void handle_tablet_tool_tip(struct libinput_event *event, wlr_event.state = WLR_TABLET_TOOL_TIP_DOWN; break; } - wl_signal_emit(&wlr_dev->tablet_tool->events.tip, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->tablet_tool->events.tip, &wlr_event); } void handle_tablet_tool_button(struct libinput_event *event, @@ -151,5 +152,5 @@ void handle_tablet_tool_button(struct libinput_event *event, wlr_event.state = WLR_BUTTON_PRESSED; break; } - wl_signal_emit(&wlr_dev->tablet_tool->events.button, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->tablet_tool->events.button, &wlr_event); } diff --git a/backend/libinput/touch.c b/backend/libinput/touch.c index 0ba6ec86..d496d792 100644 --- a/backend/libinput/touch.c +++ b/backend/libinput/touch.c @@ -5,6 +5,7 @@ #include <wlr/types/wlr_input_device.h> #include <wlr/interfaces/wlr_touch.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/libinput.h" struct wlr_touch *wlr_libinput_touch_create( @@ -37,7 +38,7 @@ void handle_touch_down(struct libinput_event *event, wlr_event.x_mm = libinput_event_touch_get_x(tevent); wlr_event.y_mm = libinput_event_touch_get_y(tevent); libinput_device_get_size(libinput_dev, &wlr_event.width_mm, &wlr_event.height_mm); - wl_signal_emit(&wlr_dev->touch->events.down, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->touch->events.down, &wlr_event); } void handle_touch_up(struct libinput_event *event, @@ -55,7 +56,7 @@ void handle_touch_up(struct libinput_event *event, wlr_event.time_msec = usec_to_msec(libinput_event_touch_get_time_usec(tevent)); wlr_event.touch_id = libinput_event_touch_get_slot(tevent); - wl_signal_emit(&wlr_dev->touch->events.up, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->touch->events.up, &wlr_event); } void handle_touch_motion(struct libinput_event *event, @@ -76,7 +77,7 @@ void handle_touch_motion(struct libinput_event *event, wlr_event.x_mm = libinput_event_touch_get_x(tevent); wlr_event.y_mm = libinput_event_touch_get_y(tevent); libinput_device_get_size(libinput_dev, &wlr_event.width_mm, &wlr_event.height_mm); - wl_signal_emit(&wlr_dev->touch->events.motion, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->touch->events.motion, &wlr_event); } void handle_touch_cancel(struct libinput_event *event, @@ -94,5 +95,5 @@ void handle_touch_cancel(struct libinput_event *event, wlr_event.time_msec = usec_to_msec(libinput_event_touch_get_time_usec(tevent)); wlr_event.touch_id = libinput_event_touch_get_slot(tevent); - wl_signal_emit(&wlr_dev->touch->events.cancel, &wlr_event); + wlr_signal_emit_safe(&wlr_dev->touch->events.cancel, &wlr_event); } diff --git a/backend/multi/backend.c b/backend/multi/backend.c index 78f5c63b..14f774d0 100644 --- a/backend/multi/backend.c +++ b/backend/multi/backend.c @@ -4,6 +4,7 @@ #include <wlr/backend/interface.h> #include <wlr/backend/session.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/multi.h" #include "backend/drm/drm.h" @@ -51,7 +52,7 @@ static void multi_backend_destroy(struct wlr_backend *wlr_backend) { } // Destroy this backend only after removing all sub-backends - wl_signal_emit(&wlr_backend->events.destroy, backend); + wlr_signal_emit_safe(&wlr_backend->events.destroy, backend); free(backend); } @@ -120,25 +121,25 @@ bool wlr_backend_is_multi(struct wlr_backend *b) { static void input_add_reemit(struct wl_listener *listener, void *data) { struct subbackend_state *state = wl_container_of(listener, state, input_add); - wl_signal_emit(&state->container->events.input_add, data); + wlr_signal_emit_safe(&state->container->events.input_add, data); } static void input_remove_reemit(struct wl_listener *listener, void *data) { struct subbackend_state *state = wl_container_of(listener, state, input_remove); - wl_signal_emit(&state->container->events.input_remove, data); + 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); - wl_signal_emit(&state->container->events.output_add, data); + 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); - wl_signal_emit(&state->container->events.output_remove, data); + wlr_signal_emit_safe(&state->container->events.output_remove, data); } static void handle_subbackend_destroy(struct wl_listener *listener, @@ -194,7 +195,7 @@ void wlr_multi_backend_add(struct wlr_backend *_multi, wl_signal_add(&backend->events.output_remove, &sub->output_remove); sub->output_remove.notify = output_remove_reemit; - wl_signal_emit(&multi->events.backend_add, backend); + wlr_signal_emit_safe(&multi->events.backend_add, backend); } void wlr_multi_backend_remove(struct wlr_backend *_multi, @@ -206,7 +207,7 @@ void wlr_multi_backend_remove(struct wlr_backend *_multi, multi_backend_get_subbackend(multi, backend); if (sub) { - wl_signal_emit(&multi->events.backend_remove, backend); + wlr_signal_emit_safe(&multi->events.backend_remove, backend); subbackend_state_destroy(sub); } } diff --git a/backend/session/direct-freebsd.c b/backend/session/direct-freebsd.c index c0621416..fe4ff653 100644 --- a/backend/session/direct-freebsd.c +++ b/backend/session/direct-freebsd.c @@ -15,6 +15,7 @@ #include <wayland-server.h> #include <wlr/backend/session/interface.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/session/direct-ipc.h" const struct session_impl session_direct; @@ -95,12 +96,12 @@ static int vt_handler(int signo, void *data) { if (session->base.active) { session->base.active = false; - wl_signal_emit(&session->base.session_signal, session); + wlr_signal_emit_safe(&session->base.session_signal, session); ioctl(session->tty_fd, VT_RELDISP, 1); } else { ioctl(session->tty_fd, VT_RELDISP, VT_ACKACQ); session->base.active = true; - wl_signal_emit(&session->base.session_signal, session); + wlr_signal_emit_safe(&session->base.session_signal, session); } return 1; diff --git a/backend/session/direct.c b/backend/session/direct.c index 9d6cd36d..245683ea 100644 --- a/backend/session/direct.c +++ b/backend/session/direct.c @@ -15,6 +15,7 @@ #include <wayland-server.h> #include <wlr/backend/session/interface.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/session/direct-ipc.h" enum { DRM_MAJOR = 226 }; @@ -107,7 +108,7 @@ static int vt_handler(int signo, void *data) { if (session->base.active) { session->base.active = false; - wl_signal_emit(&session->base.session_signal, session); + wlr_signal_emit_safe(&session->base.session_signal, session); struct wlr_device *dev; wl_list_for_each(dev, &session->base.devices, link) { @@ -130,7 +131,7 @@ static int vt_handler(int signo, void *data) { } session->base.active = true; - wl_signal_emit(&session->base.session_signal, session); + wlr_signal_emit_safe(&session->base.session_signal, session); } return 1; diff --git a/backend/session/logind.c b/backend/session/logind.c index 1ece051f..f6150817 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -13,13 +13,14 @@ #include <wlr/config.h> #include <wlr/backend/session/interface.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #ifdef WLR_HAS_SYSTEMD #include <systemd/sd-bus.h> #include <systemd/sd-login.h> #elif defined(WLR_HAS_ELOGIND) #include <elogind/sd-bus.h> - #include <elogind/sd-login.h> + #include <elogind/sd-login.h> #endif enum { DRM_MAJOR = 226 }; @@ -250,7 +251,7 @@ static int pause_device(sd_bus_message *msg, void *userdata, sd_bus_error *ret_e if (major == DRM_MAJOR) { session->base.active = false; - wl_signal_emit(&session->base.session_signal, session); + wlr_signal_emit_safe(&session->base.session_signal, session); } if (strcmp(type, "pause") == 0) { @@ -286,7 +287,7 @@ static int resume_device(sd_bus_message *msg, void *userdata, sd_bus_error *ret_ if (!session->base.active) { session->base.active = true; - wl_signal_emit(&session->base.session_signal, session); + wlr_signal_emit_safe(&session->base.session_signal, session); } } diff --git a/backend/session/session.c b/backend/session/session.c index 2bbbd4ef..4b81e230 100644 --- a/backend/session/session.c +++ b/backend/session/session.c @@ -13,6 +13,7 @@ #include <wlr/backend/session.h> #include <wlr/backend/session/interface.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> extern const struct session_impl session_logind; extern const struct session_impl session_direct; @@ -49,7 +50,7 @@ static int udev_event(int fd, uint32_t mask, void *data) { wl_list_for_each(dev, &session->devices, link) { if (dev->dev == devnum) { - wl_signal_emit(&dev->signal, session); + wlr_signal_emit_safe(&dev->signal, session); break; } } diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 458c9dd0..2907057c 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -11,6 +11,7 @@ #include <wlr/interfaces/wlr_output.h> #include <wlr/interfaces/wlr_input_device.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/wayland.h" #include "xdg-shell-unstable-v6-client-protocol.h" @@ -80,7 +81,7 @@ static void wlr_wl_backend_destroy(struct wlr_backend *wlr_backend) { wlr_input_device_destroy(input_device); } - wl_signal_emit(&wlr_backend->events.destroy, wlr_backend); + wlr_signal_emit_safe(&wlr_backend->events.destroy, wlr_backend); wl_list_remove(&backend->local_display_destroy.link); diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 0bbf6d42..f2336549 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -10,6 +10,7 @@ #include <GLES2/gl2.h> #include <wlr/interfaces/wlr_output.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/wayland.h" #include "xdg-shell-unstable-v6-client-protocol.h" @@ -338,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); - wl_signal_emit(&backend->backend.events.output_add, wlr_output); + wlr_signal_emit_safe(&backend->backend.events.output_add, wlr_output); return wlr_output; error: diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c index 37489678..2018f449 100644 --- a/backend/wayland/wl_seat.c +++ b/backend/wayland/wl_seat.c @@ -10,6 +10,7 @@ #include <wlr/interfaces/wlr_keyboard.h> #include <wlr/interfaces/wlr_touch.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/wayland.h" static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, @@ -78,7 +79,7 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer, wlr_event.height_mm = layout_box.height; wlr_event.x_mm = transformed.x + wlr_output->lx - layout_box.x; wlr_event.y_mm = transformed.y + wlr_output->ly - layout_box.y; - wl_signal_emit(&dev->pointer->events.motion_absolute, &wlr_event); + wlr_signal_emit_safe(&dev->pointer->events.motion_absolute, &wlr_event); } static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer, @@ -91,7 +92,7 @@ static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer, wlr_event.button = button; wlr_event.state = state; wlr_event.time_msec = time; - wl_signal_emit(&dev->pointer->events.button, &wlr_event); + wlr_signal_emit_safe(&dev->pointer->events.button, &wlr_event); } static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer, @@ -106,7 +107,7 @@ static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer, wlr_event.orientation = axis; wlr_event.time_msec = time; wlr_event.source = wlr_wl_pointer->axis_source; - wl_signal_emit(&dev->pointer->events.axis, &wlr_event); + wlr_signal_emit_safe(&dev->pointer->events.axis, &wlr_event); } static void pointer_handle_frame(void *data, struct wl_pointer *wl_pointer) { @@ -194,7 +195,7 @@ static struct wl_keyboard_listener keyboard_listener = { static void input_device_destroy(struct wlr_input_device *_dev) { struct wlr_wl_input_device *dev = (struct wlr_wl_input_device *)_dev; - wl_signal_emit(&dev->backend->backend.events.input_remove, &dev->wlr_input_device); + wlr_signal_emit_safe(&dev->backend->backend.events.input_remove, &dev->wlr_input_device); if (dev->resource) { wl_proxy_destroy(dev->resource); } @@ -256,7 +257,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; - wl_signal_emit(&backend->backend.events.input_add, wlr_device); + wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_device); backend->pointer = wl_pointer; } if ((caps & WL_SEAT_CAPABILITY_KEYBOARD)) { @@ -280,7 +281,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; - wl_signal_emit(&backend->backend.events.input_add, wlr_device); + wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_device); } } diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 411d0ef6..2417810a 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -22,6 +22,7 @@ #include <wlr/interfaces/wlr_keyboard.h> #include <wlr/interfaces/wlr_pointer.h> #include <wlr/util/log.h> +#include <wlr/util/signal.h> #include "backend/x11.h" static struct wlr_backend_impl backend_impl; @@ -77,7 +78,7 @@ static bool handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *e .orientation = WLR_AXIS_ORIENTATION_VERTICAL, .delta = delta, }; - wl_signal_emit(&x11->pointer.events.axis, &axis); + wlr_signal_emit_safe(&x11->pointer.events.axis, &axis); x11->time = ev->time; break; } @@ -96,7 +97,7 @@ static bool handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *e WLR_BUTTON_PRESSED : WLR_BUTTON_RELEASED, }; - wl_signal_emit(&x11->pointer.events.button, &button); + wlr_signal_emit_safe(&x11->pointer.events.button, &button); } x11->time = ev->time; break; @@ -112,7 +113,7 @@ static bool handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *e .height_mm = output->wlr_output.height, }; - wl_signal_emit(&x11->pointer.events.motion_absolute, &abs); + wlr_signal_emit_safe(&x11->pointer.events.motion_absolute, &abs); x11->time = ev->time; break; } @@ -140,7 +141,7 @@ static bool handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *e .height_mm = output->wlr_output.height, }; - wl_signal_emit(&x11->pointer.events.motion_absolute, &abs); + wlr_signal_emit_safe(&x11->pointer.events.motion_absolute, &abs); break; } case XCB_GLX_DELETE_QUERIES_ARB: { @@ -229,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); - wl_signal_emit(&x11->backend.events.output_add, output); - wl_signal_emit(&x11->backend.events.input_add, &x11->keyboard_dev); - wl_signal_emit(&x11->backend.events.input_add, &x11->pointer_dev); + 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); wl_event_source_timer_update(x11->frame_timer, 16); @@ -248,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); - wl_signal_emit(&backend->events.input_remove, &x11->pointer_dev); - wl_signal_emit(&backend->events.input_remove, &x11->keyboard_dev); + wlr_signal_emit_safe(&backend->events.input_remove, &x11->pointer_dev); + wlr_signal_emit_safe(&backend->events.input_remove, &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) { @@ -259,7 +260,7 @@ static void wlr_x11_backend_destroy(struct wlr_backend *backend) { xkb_state_unref(x11->keyboard_dev.keyboard->xkb_state); } - wl_signal_emit(&backend->events.destroy, backend); + wlr_signal_emit_safe(&backend->events.destroy, backend); wl_list_remove(&x11->display_destroy.link); |