view: respect rc.gap when moving to cursor

Fixes: #1494
This commit is contained in:
Andrew J. Hesford 2024-02-02 12:03:20 -05:00 committed by Consolatis
parent 0fe7cf6131
commit 242b94bca9

View file

@ -434,18 +434,23 @@ view_move_to_cursor(struct view *view)
int y = view->server->seat.cursor->y - (geo.height / 2); int y = view->server->seat.cursor->y - (geo.height / 2);
struct wlr_box usable = output_usable_area_in_layout_coords(pending_output); struct wlr_box usable = output_usable_area_in_layout_coords(pending_output);
/* Limit usable region to account for gap */
usable.x += rc.gap;
usable.y += rc.gap;
usable.width -= 2 * rc.gap;
usable.height -= 2 * rc.gap;
if (x + geo.width > usable.x + usable.width) { if (x + geo.width > usable.x + usable.width) {
x = usable.x + usable.width - geo.width; x = usable.x + usable.width - geo.width;
} }
x = MAX(x, usable.x); x = MAX(x, usable.x) + margin.left;
if (y + geo.height > usable.y + usable.height) { if (y + geo.height > usable.y + usable.height) {
y = usable.y + usable.height - geo.height; y = usable.y + usable.height - geo.height;
} }
y = MAX(y, usable.y); y = MAX(y, usable.y) + margin.top;
x += margin.left;
y += margin.top;
view_move(view, x, y); view_move(view, x, y);
} }