aboutsummaryrefslogtreecommitdiff
path: root/backend/x11/backend.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/x11/backend.c')
-rw-r--r--backend/x11/backend.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index 1eb5a952..11dd8568 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -1,4 +1,4 @@
-#define _POSIX_C_SOURCE 199309L
+#define _POSIX_C_SOURCE 200112L
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -8,7 +8,11 @@
#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/egl.h>
@@ -59,8 +63,7 @@ static bool handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *e
x11->time = ev->time;
break;
}
- case XCB_BUTTON_PRESS:
- case XCB_BUTTON_RELEASE: {
+ case XCB_BUTTON_PRESS: {
xcb_button_press_event_t *ev = (xcb_button_press_event_t *)event;
if (ev->detail == XCB_BUTTON_INDEX_4 ||
@@ -75,7 +78,16 @@ static bool handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *e
.delta = delta,
};
wl_signal_emit(&x11->pointer.events.axis, &axis);
- } else {
+ x11->time = ev->time;
+ break;
+ }
+ }
+ /* fallthrough */
+ case XCB_BUTTON_RELEASE: {
+ xcb_button_press_event_t *ev = (xcb_button_press_event_t *)event;
+
+ if (ev->detail != XCB_BUTTON_INDEX_4 &&
+ ev->detail != XCB_BUTTON_INDEX_5) {
struct wlr_event_pointer_button button = {
.device = &x11->pointer_dev,
.time_sec = ev->time / 1000,