diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-06 17:29:23 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-07 11:07:29 +1000 |
commit | 59ba528bd930e55263cbee03eb9dfb6bdee98caa (patch) | |
tree | 0efb1ca4ad5f610dcbffab4fe12fe493f21e16ab | |
parent | 1059e173f4c0139e909c7d8b5d450f30c0adad0e (diff) |
Use wlr_xdg_popup_get_toplevel_coords
-rw-r--r-- | sway/desktop/xdg_shell.c | 12 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 12 |
2 files changed, 10 insertions, 14 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 9036448b..2e2815c1 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -24,13 +24,11 @@ static void popup_get_root_coords(struct sway_view_child *child, int *root_sx, int *root_sy) { struct sway_xdg_popup *popup = (struct sway_xdg_popup *)child; struct wlr_xdg_surface *surface = popup->wlr_xdg_surface; - *root_sx = -surface->geometry.x; - *root_sy = -surface->geometry.y; - while (surface && surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { - *root_sx += surface->popup->geometry.x; - *root_sy += surface->popup->geometry.y; - surface = wlr_xdg_surface_from_wlr_surface(surface->popup->parent); - } + + wlr_xdg_popup_get_toplevel_coords(surface->popup, + -surface->geometry.x + surface->popup->geometry.x, + -surface->geometry.y + surface->popup->geometry.y, + root_sx, root_sy); } static void popup_destroy(struct sway_view_child *child) { diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 765a80b1..e61bd652 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -23,13 +23,11 @@ static void popup_get_root_coords(struct sway_view_child *child, int *root_sx, int *root_sy) { struct sway_xdg_popup_v6 *popup = (struct sway_xdg_popup_v6 *)child; struct wlr_xdg_surface_v6 *surface = popup->wlr_xdg_surface_v6; - *root_sx = -surface->geometry.x; - *root_sy = -surface->geometry.y; - while (surface && surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) { - *root_sx += surface->popup->geometry.x; - *root_sy += surface->popup->geometry.y; - surface = surface->popup->parent; - } + + wlr_xdg_popup_v6_get_toplevel_coords(surface->popup, + -surface->geometry.x + surface->popup->geometry.x, + -surface->geometry.y + surface->popup->geometry.y, + root_sx, root_sy); } static void popup_destroy(struct sway_view_child *child) { |