From 5e58d46cc1a90810e3ee76203cee8ca2f14fb462 Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 12 Feb 2018 09:12:31 +0100 Subject: Add wlr_signal_emit_safe --- backend/x11/backend.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'backend/x11') 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 #include #include +#include #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); -- cgit v1.2.3