xdg-shell: use toplevel geometry to adjust the popup box

`popup_unconstrain` uses view coordinates to init the output box for
popups. However wlroots expects the box to be set in a toplevel surface
coordinate system, which is not always equal to view. The difference
between those is a window geometry set via xdg-shell.

GTK4 reserves some space for client-side decoration and thus has a
window with top left corner not matching to (0, 0) of a surface. The box
calculated without taking that into account was slightly shifted
compared to the actual output and allowed to position part of the popup
off screen.
This commit is contained in:
Aleksei Bavshin 2021-12-22 22:25:27 -08:00 committed by Simon Ser
parent e1db1f8218
commit aa443629b5

View file

@ -72,8 +72,8 @@ static void popup_unconstrain(struct sway_xdg_popup *popup) {
// the output box expressed in the coordinate system of the toplevel parent
// of the popup
struct wlr_box output_toplevel_sx_box = {
.x = output->lx - view->container->pending.content_x,
.y = output->ly - view->container->pending.content_y,
.x = output->lx - view->container->pending.content_x + view->geometry.x,
.y = output->ly - view->container->pending.content_y + view->geometry.y,
.width = output->width,
.height = output->height,
};