diff options
author | Kirill Primak <vyivel@posteo.net> | 2021-09-07 16:12:21 +0300 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-09-08 09:36:17 +0200 |
commit | e76e13ef854a3f1d291521c6f2c9d6e936bca184 (patch) | |
tree | aec96e56e68ac5f70065461878ea31c09f2f3399 /sway/desktop | |
parent | adf9e16c88d1ac80184f726a4d6e2a5359b69ba9 (diff) | |
download | sway-e76e13ef854a3f1d291521c6f2c9d6e936bca184.tar.xz |
view: fix child position calc
Previously, the position was calculated incorrectly for nested
subsurfaces.
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/xdg_shell.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 1f70b193..a97ee8be 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -21,18 +21,15 @@ static const struct sway_view_child_impl popup_impl; -static void popup_get_root_coords(struct sway_view_child *child, - int *root_sx, int *root_sy) { +static void popup_get_view_coords(struct sway_view_child *child, + int *sx, int *sy) { struct sway_xdg_popup *popup = (struct sway_xdg_popup *)child; struct wlr_xdg_surface *surface = popup->wlr_xdg_surface; - int x_offset = -child->view->geometry.x - surface->geometry.x; - int y_offset = -child->view->geometry.y - surface->geometry.y; - wlr_xdg_popup_get_toplevel_coords(surface->popup, - x_offset + surface->popup->geometry.x, - y_offset + surface->popup->geometry.y, - root_sx, root_sy); + surface->popup->geometry.x - surface->geometry.x, + surface->popup->geometry.y - surface->geometry.y, + sx, sy); } static void popup_destroy(struct sway_view_child *child) { @@ -47,7 +44,7 @@ static void popup_destroy(struct sway_view_child *child) { } static const struct sway_view_child_impl popup_impl = { - .get_root_coords = popup_get_root_coords, + .get_view_coords = popup_get_view_coords, .destroy = popup_destroy, }; |