mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-18 06:47:31 -04:00
Merge branch 'keshto-master-patch-72360' into 'master'
tinywl: Properly handle cursor motion when button is held. See merge request wlroots/wlroots!3653
This commit is contained in:
commit
4231a68b25
1 changed files with 12 additions and 1 deletions
|
|
@ -31,6 +31,7 @@ enum tinywl_cursor_mode {
|
||||||
TINYWL_CURSOR_PASSTHROUGH,
|
TINYWL_CURSOR_PASSTHROUGH,
|
||||||
TINYWL_CURSOR_MOVE,
|
TINYWL_CURSOR_MOVE,
|
||||||
TINYWL_CURSOR_RESIZE,
|
TINYWL_CURSOR_RESIZE,
|
||||||
|
TINYWL_CURSOR_DOWN,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tinywl_server {
|
struct tinywl_server {
|
||||||
|
|
@ -453,7 +454,13 @@ static void process_cursor_motion(struct tinywl_server *server, uint32_t time) {
|
||||||
* around the screen, not over any views. */
|
* around the screen, not over any views. */
|
||||||
wlr_cursor_set_xcursor(server->cursor, server->cursor_mgr, "default");
|
wlr_cursor_set_xcursor(server->cursor, server->cursor_mgr, "default");
|
||||||
}
|
}
|
||||||
if (surface) {
|
if (server->cursor_mode == TINYWL_CURSOR_DOWN && view != server->grabbed_view) {
|
||||||
|
/* Send pointer events to the view which the mouse button is down on. */
|
||||||
|
view = server->grabbed_view;
|
||||||
|
sx = server->cursor->x - view->x;
|
||||||
|
sy = server->cursor->y - view->y;
|
||||||
|
wlr_seat_pointer_notify_motion(seat, time, sx, sy);
|
||||||
|
} else if (surface) {
|
||||||
/*
|
/*
|
||||||
* Send pointer enter and motion events.
|
* Send pointer enter and motion events.
|
||||||
*
|
*
|
||||||
|
|
@ -525,6 +532,10 @@ static void server_cursor_button(struct wl_listener *listener, void *data) {
|
||||||
} else {
|
} else {
|
||||||
/* Focus that client if the button was _pressed_ */
|
/* Focus that client if the button was _pressed_ */
|
||||||
focus_view(view, surface);
|
focus_view(view, surface);
|
||||||
|
|
||||||
|
/* Change the cursor_mode while the button is pressed */
|
||||||
|
server->grabbed_view = view;
|
||||||
|
server->cursor_mode = TINYWL_CURSOR_DOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue