diff options
Diffstat (limited to 'sway/desktop/xdg_shell_v6.c')
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index ff950c70..165cc7eb 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -19,6 +19,17 @@ | |||
19 | 19 | ||
20 | static const struct sway_view_child_impl popup_impl; | 20 | static const struct sway_view_child_impl popup_impl; |
21 | 21 | ||
22 | static void popup_get_root_coords(struct sway_view_child *child, | ||
23 | int *root_sx, int *root_sy) { | ||
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; | ||
26 | |||
27 | wlr_xdg_popup_v6_get_toplevel_coords(surface->popup, | ||
28 | -surface->geometry.x + surface->popup->geometry.x, | ||
29 | -surface->geometry.y + surface->popup->geometry.y, | ||
30 | root_sx, root_sy); | ||
31 | } | ||
32 | |||
22 | static void popup_destroy(struct sway_view_child *child) { | 33 | static void popup_destroy(struct sway_view_child *child) { |
23 | if (!sway_assert(child->impl == &popup_impl, | 34 | if (!sway_assert(child->impl == &popup_impl, |
24 | "Expected an xdg_shell_v6 popup")) { | 35 | "Expected an xdg_shell_v6 popup")) { |
@@ -31,6 +42,7 @@ static void popup_destroy(struct sway_view_child *child) { | |||
31 | } | 42 | } |
32 | 43 | ||
33 | static const struct sway_view_child_impl popup_impl = { | 44 | static const struct sway_view_child_impl popup_impl = { |
45 | .get_root_coords = popup_get_root_coords, | ||
34 | .destroy = popup_destroy, | 46 | .destroy = popup_destroy, |
35 | }; | 47 | }; |
36 | 48 | ||
@@ -84,6 +96,9 @@ static struct sway_xdg_popup_v6 *popup_create( | |||
84 | wl_signal_add(&xdg_surface->events.destroy, &popup->destroy); | 96 | wl_signal_add(&xdg_surface->events.destroy, &popup->destroy); |
85 | popup->destroy.notify = popup_handle_destroy; | 97 | popup->destroy.notify = popup_handle_destroy; |
86 | 98 | ||
99 | wl_signal_add(&xdg_surface->events.map, &popup->child.surface_map); | ||
100 | wl_signal_add(&xdg_surface->events.unmap, &popup->child.surface_unmap); | ||
101 | |||
87 | popup_unconstrain(popup); | 102 | popup_unconstrain(popup); |
88 | 103 | ||
89 | return popup; | 104 | return popup; |