From 21626e8153490bf155e812644454fe9610491ffd Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sun, 10 Dec 2017 11:11:47 -0500 Subject: seat focus on button press --- sway/input/cursor.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sway/input/cursor.c') 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 @@ #define _XOPEN_SOURCE 700 +#ifdef __linux__ +#include +#elif __FreeBSD__ +#include +#endif #include #include #include "sway/input/cursor.h" @@ -57,6 +62,16 @@ static void handle_cursor_button(struct wl_listener *listener, void *data) { struct sway_cursor *cursor = wl_container_of(listener, cursor, button); struct wlr_event_pointer_button *event = data; + + if (event->button == BTN_LEFT) { + struct wlr_surface *surface = NULL; + double sx, sy; + swayc_t *swayc = + swayc_at(&root_container, cursor->x, cursor->y, &surface, &sx, &sy); + + sway_seat_set_focus(cursor->seat, swayc); + } + wlr_seat_pointer_notify_button(cursor->seat->seat, event->time_msec, event->button, event->state); } -- cgit v1.2.3-54-g00ecf