mirror of
https://github.com/swaywm/sway.git
synced 2025-11-10 13:29:51 -05:00
seat focus on button press
This commit is contained in:
parent
0fdecb4d3a
commit
21626e8153
7 changed files with 90 additions and 4 deletions
|
|
@ -1,4 +1,9 @@
|
|||
#define _XOPEN_SOURCE 700
|
||||
#ifdef __linux__
|
||||
#include <linux/input-event-codes.h>
|
||||
#elif __FreeBSD__
|
||||
#include <dev/evdev/input-event-codes.h>
|
||||
#endif
|
||||
#include <wlr/types/wlr_cursor.h>
|
||||
#include <wlr/types/wlr_xcursor_manager.h>
|
||||
#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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue