[gtk+/gtk-3-22] wayland: Handle subsurface as popup parent
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] wayland: Handle subsurface as popup parent
- Date: Fri, 6 Jan 2017 03:08:40 +0000 (UTC)
commit 5bae71f896eb5516c04b1b2374aaff05cfb8b3c0
Author: Jonas Ådahl <jadahl gmail com>
Date: Thu Jan 5 16:01:49 2017 +0800
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).
https://bugzilla.gnome.org/show_bug.cgi?id=776225
gdk/wayland/gdkwindow-wayland.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 0314117..8fce48b 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -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 =
+ GDK_WINDOW_IMPL_WAYLAND (parent->impl);
+ GdkWindow *effective_parent = gdk_window_get_effective_parent (parent);
+
+ if ((gdk_window_has_native (parent) &&
+ !parent_impl->display_server.wl_subsurface) ||
+ !effective_parent)
+ break;
+
*x += parent->x;
*y += parent->y;
- parent = gdk_window_get_effective_parent (parent);
+
+ if (gdk_window_has_native (parent) &&
+ parent_impl->display_server.wl_subsurface)
+ parent = parent->transient_for;
+ else
+ parent = effective_parent;
}
return parent;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]