xwayland: Don't center views with explicitly specified position

This commit is contained in:
John Lindgren 2022-09-04 21:45:03 -04:00 committed by Johan Malm
parent b8096b1bab
commit 2e81cc13d4

View file

@ -276,6 +276,27 @@ handle_override_redirect(struct wl_listener *listener, void *data)
}
}
static void
set_initial_position(struct view *view)
{
/* Don't center views with position explicitly specified */
bool has_position = view->xwayland_surface->size_hints &&
(view->xwayland_surface->size_hints->flags &
(XCB_ICCCM_SIZE_HINT_US_POSITION |
XCB_ICCCM_SIZE_HINT_P_POSITION));
if (has_position) {
/* Just make sure the view is on-screen */
view_adjust_for_layout_change(view);
} else {
struct wlr_box box =
output_usable_area_from_cursor_coords(view->server);
view->x = box.x;
view->y = box.y;
view_center(view);
}
}
static void
top_left_edge_boundary_check(struct view *view)
{
@ -333,11 +354,7 @@ map(struct view *view)
}
if (!view->maximized && !view->fullscreen) {
struct wlr_box box =
output_usable_area_from_cursor_coords(view->server);
view->x = box.x;
view->y = box.y;
view_center(view);
set_initial_position(view);
}
view_moved(view);