From e76e13ef854a3f1d291521c6f2c9d6e936bca184 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Tue, 7 Sep 2021 16:12:21 +0300 Subject: view: fix child position calc Previously, the position was calculated incorrectly for nested subsurfaces. --- sway/desktop/xdg_shell.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'sway/desktop/xdg_shell.c') 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, }; -- cgit v1.2.3-54-g00ecf