From 9a6687ee04db948a9f61cf2f4cc5966be84c822c Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 7 Feb 2022 20:55:02 +0100 Subject: [PATCH] xdg-shell: use wlr_xdg_popup in sway_xdg_popup Improved type safety. --- include/sway/tree/view.h | 2 +- sway/desktop/xdg_shell.c | 12 ++++++------ 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 { struct sway_xdg_popup { struct sway_view_child child; - struct wlr_xdg_surface *wlr_xdg_surface; + struct wlr_xdg_popup *wlr_xdg_popup; struct wl_listener new_popup; 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; 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; + struct wlr_xdg_popup *wlr_popup = popup->wlr_xdg_popup; - wlr_xdg_popup_get_toplevel_coords(surface->popup, - surface->popup->geometry.x - surface->current.geometry.x, - surface->popup->geometry.y - surface->current.geometry.y, + wlr_xdg_popup_get_toplevel_coords(wlr_popup, + wlr_popup->geometry.x - wlr_popup->base->current.geometry.x, + wlr_popup->geometry.y - wlr_popup->base->current.geometry.y, sx, sy); } @@ -65,7 +65,7 @@ static void popup_handle_destroy(struct wl_listener *listener, void *data) { static void popup_unconstrain(struct sway_xdg_popup *popup) { struct sway_view *view = popup->child.view; - struct wlr_xdg_popup *wlr_popup = popup->wlr_xdg_surface->popup; + struct wlr_xdg_popup *wlr_popup = popup->wlr_xdg_popup; struct sway_output *output = view->container->pending.workspace->output; @@ -91,7 +91,7 @@ static struct sway_xdg_popup *popup_create( return NULL; } view_child_init(&popup->child, &popup_impl, view, xdg_surface->surface); - popup->wlr_xdg_surface = xdg_surface; + popup->wlr_xdg_popup = xdg_surface->popup; wl_signal_add(&xdg_surface->events.new_popup, &popup->new_popup); popup->new_popup.notify = popup_handle_new_popup;