aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-20 23:18:56 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-20 23:18:56 +1000
commit93ec1af4d9980288a3264c985fb8e5b8755b384a (patch)
tree5877e1958d877c15c3dd1ac52cb71764f5428663
parentMerge pull request #2887 from RyanDwyer/bar-overlay (diff)
downloadsway-93ec1af4d9980288a3264c985fb8e5b8755b384a.tar.gz
sway-93ec1af4d9980288a3264c985fb8e5b8755b384a.tar.zst
sway-93ec1af4d9980288a3264c985fb8e5b8755b384a.zip
Fix popup damage issues when toplevel and/or popup uses geometry
The wlr_xdg_popup_get_toplevel_coords function has the following quirks: * It does not do anything with the coordinates of the passed popup. Instead, we are required to add them ourselves, which we do by passing them to the function as the surface local values. * It adds the geometry (shadows etc) of the toplevel itself, so the coordinates are surface local rather than content local. For this reason, we have to negate the toplevel's geometry (child->view->geometry). * I may be wrong, but the popup positions appear to be stored in surface local coordinates rather than content local coordinates. The geometry (shadows etc) of the popup itself must be negated (surface->geometry).
-rw-r--r--sway/desktop/xdg_shell.c7
-rw-r--r--sway/desktop/xdg_shell_v6.c7
2 files changed, 10 insertions, 4 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 1ed45a6b..fda1bdef 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -25,9 +25,12 @@ static void popup_get_root_coords(struct sway_view_child *child,
25 struct sway_xdg_popup *popup = (struct sway_xdg_popup *)child; 25 struct sway_xdg_popup *popup = (struct sway_xdg_popup *)child;
26 struct wlr_xdg_surface *surface = popup->wlr_xdg_surface; 26 struct wlr_xdg_surface *surface = popup->wlr_xdg_surface;
27 27
28 int x_offset = -child->view->geometry.x - surface->geometry.x;
29 int y_offset = -child->view->geometry.y - surface->geometry.y;
30
28 wlr_xdg_popup_get_toplevel_coords(surface->popup, 31 wlr_xdg_popup_get_toplevel_coords(surface->popup,
29 -surface->geometry.x + surface->popup->geometry.x, 32 x_offset + surface->popup->geometry.x,
30 -surface->geometry.y + surface->popup->geometry.y, 33 y_offset + surface->popup->geometry.y,
31 root_sx, root_sy); 34 root_sx, root_sy);
32} 35}
33 36
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index eb8ba853..7159f1ed 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -24,9 +24,12 @@ static void popup_get_root_coords(struct sway_view_child *child,
24 struct sway_xdg_popup_v6 *popup = (struct sway_xdg_popup_v6 *)child; 24 struct sway_xdg_popup_v6 *popup = (struct sway_xdg_popup_v6 *)child;
25 struct wlr_xdg_surface_v6 *surface = popup->wlr_xdg_surface_v6; 25 struct wlr_xdg_surface_v6 *surface = popup->wlr_xdg_surface_v6;
26 26
27 int x_offset = -child->view->geometry.x - surface->geometry.x;
28 int y_offset = -child->view->geometry.y - surface->geometry.y;
29
27 wlr_xdg_popup_v6_get_toplevel_coords(surface->popup, 30 wlr_xdg_popup_v6_get_toplevel_coords(surface->popup,
28 -surface->geometry.x + surface->popup->geometry.x, 31 x_offset + surface->popup->geometry.x,
29 -surface->geometry.y + surface->popup->geometry.y, 32 y_offset + surface->popup->geometry.y,
30 root_sx, root_sy); 33 root_sx, root_sy);
31} 34}
32 35