From b364634a9c9d83f127088d45a32fde8bb8f91eb5 Mon Sep 17 00:00:00 2001 From: tiosgz Date: Wed, 15 Sep 2021 17:02:06 +0000 Subject: [PATCH] Fix top edge interactive resize The view jumped to the cursor position vertically. While making this change, I also put some consistency into how position and size are set (first the original ones are considered, and then only updated as needed). It doesn't change the functionality, but is easier to understand IMO. --- kiwmi/input/cursor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kiwmi/input/cursor.c b/kiwmi/input/cursor.c index c15e1fa..d52222a 100644 --- a/kiwmi/input/cursor.c +++ b/kiwmi/input/cursor.c @@ -47,14 +47,14 @@ process_cursor_motion(struct kiwmi_server *server, uint32_t time) int dy = cursor->cursor->y - cursor->grabbed.orig_y; struct wlr_box new_geom = { - .x = view->x, - .y = view->y, + .x = cursor->grabbed.orig_geom.x, + .y = cursor->grabbed.orig_geom.y, .width = cursor->grabbed.orig_geom.width, .height = cursor->grabbed.orig_geom.height, }; if (cursor->grabbed.resize_edges & WLR_EDGE_TOP) { - new_geom.y = cursor->grabbed.orig_y + dy; + new_geom.y += dy; new_geom.height -= dy; if (new_geom.height < 1) { new_geom.y += new_geom.height; @@ -64,7 +64,7 @@ process_cursor_motion(struct kiwmi_server *server, uint32_t time) } if (cursor->grabbed.resize_edges & WLR_EDGE_LEFT) { - new_geom.x = cursor->grabbed.orig_geom.x + dx; + new_geom.x += dx; new_geom.width -= dx; if (new_geom.width < 1) { new_geom.x += new_geom.width;