aboutsummaryrefslogtreecommitdiff
path: root/backend/x11
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-02-13 08:30:54 -0500
committerGitHub <noreply@github.com>2018-02-13 08:30:54 -0500
commit71cba94e73022d8cef8651055204a4706377ae11 (patch)
tree8ea1a2b6a0414fd7904824ffac330cd4e1e96ca2 /backend/x11
parent3497e53516d96ad67b26115e2e06218f68e1114d (diff)
parentc2e147401048aa53aebd52f1851b1da8c91043a3 (diff)
Merge pull request #627 from emersion/wlr-signal-emit-safe
Remove wlr_backend.events.{output_remove,device_remove}
Diffstat (limited to 'backend/x11')
-rw-r--r--backend/x11/backend.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index 411d0ef6..28a4fcac 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -1,28 +1,29 @@
#define _POSIX_C_SOURCE 200112L
+#include <EGL/egl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include <EGL/egl.h>
#include <wayland-server.h>
-#include <xcb/xcb.h>
-#include <xcb/glx.h>
-#include <X11/Xlib-xcb.h>
-#ifdef __linux__
-#include <linux/input-event-codes.h>
-#elif __FreeBSD__
-#include <dev/evdev/input-event-codes.h>
-#endif
#include <wlr/backend/interface.h>
#include <wlr/backend/x11.h>
-#include <wlr/render/egl.h>
-#include <wlr/render/gles2.h>
-#include <wlr/interfaces/wlr_output.h>
#include <wlr/interfaces/wlr_input_device.h>
#include <wlr/interfaces/wlr_keyboard.h>
+#include <wlr/interfaces/wlr_output.h>
#include <wlr/interfaces/wlr_pointer.h>
+#include <wlr/render/egl.h>
+#include <wlr/render/gles2.h>
#include <wlr/util/log.h>
+#include <X11/Xlib-xcb.h>
+#include <xcb/glx.h>
+#include <xcb/xcb.h>
+#ifdef __linux__
+#include <linux/input-event-codes.h>
+#elif __FreeBSD__
+#include <dev/evdev/input-event-codes.h>
+#endif
#include "backend/x11.h"
+#include "util/signal.h"
static struct wlr_backend_impl backend_impl;
static struct wlr_output_impl output_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.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);
@@ -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(&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) {
@@ -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);