aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2022-02-07 20:55:02 +0100
committerLibravatar Kirill Primak <vyivel@eclair.cafe>2022-02-07 23:22:16 +0300
commit9a6687ee04db948a9f61cf2f4cc5966be84c822c (patch)
treeb3847e914c9025244e6b525c0c06c14238e1d528
parentxdg-shell: use wlr_xdg_toplevel in sway_view (diff)
downloadsway-9a6687ee04db948a9f61cf2f4cc5966be84c822c.tar.gz
sway-9a6687ee04db948a9f61cf2f4cc5966be84c822c.tar.zst
sway-9a6687ee04db948a9f61cf2f4cc5966be84c822c.zip
xdg-shell: use wlr_xdg_popup in sway_xdg_popup
Improved type safety.
-rw-r--r--include/sway/tree/view.h2
-rw-r--r--sway/desktop/xdg_shell.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 5f8d2f58..95708a04 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -217,7 +217,7 @@ struct sway_subsurface {
217struct sway_xdg_popup { 217struct sway_xdg_popup {
218 struct sway_view_child child; 218 struct sway_view_child child;
219 219
220 struct wlr_xdg_surface *wlr_xdg_surface; 220 struct wlr_xdg_popup *wlr_xdg_popup;
221 221
222 struct wl_listener new_popup; 222 struct wl_listener new_popup;
223 struct wl_listener destroy; 223 struct wl_listener destroy;
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index fe6e0fae..6af67207 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -24,11 +24,11 @@ static const struct sway_view_child_impl popup_impl;
24static void popup_get_view_coords(struct sway_view_child *child, 24static void popup_get_view_coords(struct sway_view_child *child,
25 int *sx, int *sy) { 25 int *sx, int *sy) {
26 struct sway_xdg_popup *popup = (struct sway_xdg_popup *)child; 26 struct sway_xdg_popup *popup = (struct sway_xdg_popup *)child;
27 struct wlr_xdg_surface *surface = popup->wlr_xdg_surface; 27 struct wlr_xdg_popup *wlr_popup = popup->wlr_xdg_popup;
28 28
29 wlr_xdg_popup_get_toplevel_coords(surface->popup, 29 wlr_xdg_popup_get_toplevel_coords(wlr_popup,
30 surface->popup->geometry.x - surface->current.geometry.x, 30 wlr_popup->geometry.x - wlr_popup->base->current.geometry.x,
31 surface->popup->geometry.y - surface->current.geometry.y, 31 wlr_popup->geometry.y - wlr_popup->base->current.geometry.y,
32 sx, sy); 32 sx, sy);
33} 33}
34 34
@@ -65,7 +65,7 @@ static void popup_handle_destroy(struct wl_listener *listener, void *data) {
65 65
66static void popup_unconstrain(struct sway_xdg_popup *popup) { 66static void popup_unconstrain(struct sway_xdg_popup *popup) {
67 struct sway_view *view = popup->child.view; 67 struct sway_view *view = popup->child.view;
68 struct wlr_xdg_popup *wlr_popup = popup->wlr_xdg_surface->popup; 68 struct wlr_xdg_popup *wlr_popup = popup->wlr_xdg_popup;
69 69
70 struct sway_output *output = view->container->pending.workspace->output; 70 struct sway_output *output = view->container->pending.workspace->output;
71 71
@@ -91,7 +91,7 @@ static struct sway_xdg_popup *popup_create(
91 return NULL; 91 return NULL;
92 } 92 }
93 view_child_init(&popup->child, &popup_impl, view, xdg_surface->surface); 93 view_child_init(&popup->child, &popup_impl, view, xdg_surface->surface);
94 popup->wlr_xdg_surface = xdg_surface; 94 popup->wlr_xdg_popup = xdg_surface->popup;
95 95
96 wl_signal_add(&xdg_surface->events.new_popup, &popup->new_popup); 96 wl_signal_add(&xdg_surface->events.new_popup, &popup->new_popup);
97 popup->new_popup.notify = popup_handle_new_popup; 97 popup->new_popup.notify = popup_handle_new_popup;