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.
This commit is contained in:
parent
8e58279c26
commit
251afa161d
1 changed files with 4 additions and 4 deletions
|
@ -47,14 +47,14 @@ process_cursor_motion(struct kiwmi_server *server, uint32_t time)
|
||||||
int dy = cursor->cursor->y - cursor->grabbed.orig_y;
|
int dy = cursor->cursor->y - cursor->grabbed.orig_y;
|
||||||
|
|
||||||
struct wlr_box new_geom = {
|
struct wlr_box new_geom = {
|
||||||
.x = view->x,
|
.x = cursor->grabbed.orig_geom.x,
|
||||||
.y = view->y,
|
.y = cursor->grabbed.orig_geom.y,
|
||||||
.width = cursor->grabbed.orig_geom.width,
|
.width = cursor->grabbed.orig_geom.width,
|
||||||
.height = cursor->grabbed.orig_geom.height,
|
.height = cursor->grabbed.orig_geom.height,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (cursor->grabbed.resize_edges & WLR_EDGE_TOP) {
|
if (cursor->grabbed.resize_edges & WLR_EDGE_TOP) {
|
||||||
new_geom.y = cursor->grabbed.orig_y + dy;
|
new_geom.y += dy;
|
||||||
new_geom.height -= dy;
|
new_geom.height -= dy;
|
||||||
if (new_geom.height < 1) {
|
if (new_geom.height < 1) {
|
||||||
new_geom.y += new_geom.height;
|
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) {
|
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;
|
new_geom.width -= dx;
|
||||||
if (new_geom.width < 1) {
|
if (new_geom.width < 1) {
|
||||||
new_geom.x += new_geom.width;
|
new_geom.x += new_geom.width;
|
||||||
|
|
Loading…
Reference in a new issue