fix resizing and moving window when cursor is not inside of it

This commit is contained in:
2026-04-03 12:43:17 +07:00
parent 698e89685c
commit 7e3ca8238c
2 changed files with 15 additions and 14 deletions
+14 -13
View File
@@ -149,22 +149,23 @@ void server_cursor_button(struct wl_listener *listener, void *data)
double sx, sy; double sx, sy;
struct wlr_surface *surface = NULL; struct wlr_surface *surface = NULL;
struct absinthe_toplevel *toplevel = absinthe_toplevel_at(server, server->cursor->x, server->cursor->y, &surface, &sx, &sy); struct absinthe_toplevel *toplevel = absinthe_toplevel_at(server, server->cursor->x, server->cursor->y, &surface, &sx, &sy);
focus_toplevel(toplevel);
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(server->seat);
uint32_t mods = wlr_keyboard_get_modifiers(keyboard);
if (mods & ABSINTHE_CURSOR_MOD) {
if (event->button == ABSINTHE_CURSOR_MOVE_BUTTON) {
server->cursor_mode = ABSINTHE_CURSOR_MOVE;
wlr_cursor_set_xcursor(server->cursor, server->cursor_mgr, "all-scroll");
handled = true;
} else if (event->button == ABSINTHE_CURSOR_RESIZE_BUTTON) {
server->cursor_mode = ABSINTHE_CURSOR_RESIZE;
handled = true;
}
}
if (toplevel) { if (toplevel) {
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(server->seat);
uint32_t mods = wlr_keyboard_get_modifiers(keyboard);
if (mods & ABSINTHE_CURSOR_MOD) {
if (event->button == ABSINTHE_CURSOR_MOVE_BUTTON) {
server->cursor_mode = ABSINTHE_CURSOR_MOVE;
wlr_cursor_set_xcursor(server->cursor, server->cursor_mgr, "all-scroll");
handled = true;
} else if (event->button == ABSINTHE_CURSOR_RESIZE_BUTTON) {
server->cursor_mode = ABSINTHE_CURSOR_RESIZE;
handled = true;
}
}
focus_toplevel(toplevel);
server->grab_x = server->cursor->x; server->grab_x = server->cursor->x;
server->grab_y = server->cursor->y; server->grab_y = server->cursor->y;