fix resizing and moving window when cursor is not inside of it
This commit is contained in:
+1
-1
@@ -47,7 +47,7 @@ static void apply_resize(struct absinthe_toplevel *toplevel, struct wlr_box *new
|
|||||||
|
|
||||||
if (max_height == 0)
|
if (max_height == 0)
|
||||||
max_height = 10000;
|
max_height = 10000;
|
||||||
|
|
||||||
if (new_geometry->width - 2 * bw >= min_width && new_geometry->width - 2 * bw <= max_width) {
|
if (new_geometry->width - 2 * bw >= min_width && new_geometry->width - 2 * bw <= max_width) {
|
||||||
toplevel->geometry.x = new_geometry->x;
|
toplevel->geometry.x = new_geometry->x;
|
||||||
toplevel->geometry.width = new_geometry->width;
|
toplevel->geometry.width = new_geometry->width;
|
||||||
|
|||||||
+14
-13
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user