mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
Add wlr_signal_emit_safe
This commit is contained in:
parent
3497e53516
commit
5e58d46cc1
43 changed files with 265 additions and 182 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue