diff options
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r-- | sway/input/cursor.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 5f2d650e..217c2ddb 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -1,4 +1,9 @@ | |||
1 | #define _XOPEN_SOURCE 700 | 1 | #define _XOPEN_SOURCE 700 |
2 | #ifdef __linux__ | ||
3 | #include <linux/input-event-codes.h> | ||
4 | #elif __FreeBSD__ | ||
5 | #include <dev/evdev/input-event-codes.h> | ||
6 | #endif | ||
2 | #include <wlr/types/wlr_cursor.h> | 7 | #include <wlr/types/wlr_cursor.h> |
3 | #include <wlr/types/wlr_xcursor_manager.h> | 8 | #include <wlr/types/wlr_xcursor_manager.h> |
4 | #include "sway/input/cursor.h" | 9 | #include "sway/input/cursor.h" |
@@ -57,6 +62,16 @@ static void handle_cursor_button(struct wl_listener *listener, void *data) { | |||
57 | struct sway_cursor *cursor = | 62 | struct sway_cursor *cursor = |
58 | wl_container_of(listener, cursor, button); | 63 | wl_container_of(listener, cursor, button); |
59 | struct wlr_event_pointer_button *event = data; | 64 | struct wlr_event_pointer_button *event = data; |
65 | |||
66 | if (event->button == BTN_LEFT) { | ||
67 | struct wlr_surface *surface = NULL; | ||
68 | double sx, sy; | ||
69 | swayc_t *swayc = | ||
70 | swayc_at(&root_container, cursor->x, cursor->y, &surface, &sx, &sy); | ||
71 | |||
72 | sway_seat_set_focus(cursor->seat, swayc); | ||
73 | } | ||
74 | |||
60 | wlr_seat_pointer_notify_button(cursor->seat->seat, event->time_msec, | 75 | wlr_seat_pointer_notify_button(cursor->seat->seat, event->time_msec, |
61 | event->button, event->state); | 76 | event->button, event->state); |
62 | } | 77 | } |