commit dafd093995a91f7ce205688fd36d45a4a26ccffd
parent 3b11d056e0aeab3452fcf991bba088991f33ab08
Author: deurzen <max@deurzen.net>
Date: Thu, 2 Jun 2022 10:08:59 +0200
fixes xdg shell popup rendering segfault
Diffstat:
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/kranewl/server.cc b/src/kranewl/server.cc
@@ -316,8 +316,8 @@ Server::handle_output_manager_test(struct wl_listener*, void*)
}
-static inline View_ptr
-view_from_popup(struct wlr_xdg_popup* popup)
+static inline XDGView_ptr
+xdg_view_from_popup(struct wlr_xdg_popup* popup)
{
struct wlr_xdg_surface* surface = popup->base;
@@ -331,7 +331,7 @@ view_from_popup(struct wlr_xdg_popup* popup)
surface = wlr_xdg_surface_from_wlr_surface(surface->popup->parent);
break;
}
- case WLR_XDG_SURFACE_ROLE_TOPLEVEL: return reinterpret_cast<View_ptr>(surface->data);
+ case WLR_XDG_SURFACE_ROLE_TOPLEVEL: return reinterpret_cast<XDGView_ptr>(surface->data);
case WLR_XDG_SURFACE_ROLE_NONE: return nullptr;
}
}
@@ -349,18 +349,17 @@ Server::handle_new_xdg_surface(struct wl_listener* listener, void* data)
switch (xdg_surface->role) {
case WLR_XDG_SURFACE_ROLE_POPUP:
{
- struct wlr_box mappable_box;
- struct wlr_scene_node* parent_node
- = reinterpret_cast<struct wlr_scene_node*>(xdg_surface->popup->parent->data);
-
- xdg_surface->data
- = wlr_scene_xdg_surface_create(parent_node, xdg_surface);
+ xdg_surface->surface->data = wlr_scene_xdg_surface_create(
+ reinterpret_cast<struct wlr_scene_node*>(xdg_surface->popup->parent->data),
+ xdg_surface
+ );
- if (!(view = view_from_popup(xdg_surface->popup)) || !view->mp_output)
+ XDGView_ptr view;
+ if (!(view = xdg_view_from_popup(xdg_surface->popup)) || !view->mp_output)
return;
Region const& active_region = view->active_region();
- mappable_box = view->mp_output->placeable_region();
+ struct wlr_box mappable_box = view->mp_output->placeable_region();
mappable_box.x -= active_region.pos.x;
mappable_box.y -= active_region.pos.y;