Commit 5bae71f8 authored by Jonas Ådahl's avatar Jonas Ådahl

wayland: Handle subsurface as popup parent

When a subsurface is used as a parent of a popup, GDK needs to traverse
up to the transient-for as the next parent, to properly find the parent
used by the popup positioner. This is because the parent of a popup
must always either be an xdg_popup or an xdg_surface, but traversing
the "parent" (in GDK terms) upwards from a subsurface will end up on
the fake root window before we hit the actual parent (in Wayland terms).
parent bea4c089
......@@ -1656,13 +1656,25 @@ get_real_parent_and_translate (GdkWindow *window,
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWindow *parent = impl->transient_for;
while (parent &&
!gdk_window_has_native (parent) &&
gdk_window_get_effective_parent (parent))
while (parent)
GdkWindowImplWayland *parent_impl =
GdkWindow *effective_parent = gdk_window_get_effective_parent (parent);
if ((gdk_window_has_native (parent) &&
!parent_impl->display_server.wl_subsurface) ||
*x += parent->x;
*y += parent->y;
parent = gdk_window_get_effective_parent (parent);
if (gdk_window_has_native (parent) &&
parent = parent->transient_for;
parent = effective_parent;
return parent;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment