[gtk+/gtk-3-22] gdkwindow: subsurface in gdk_window_get_effective_parent()
- From: Olivier Fourdan <ofourdan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] gdkwindow: subsurface in gdk_window_get_effective_parent()
- Date: Thu, 23 Feb 2017 13:17:12 +0000 (UTC)
commit e5b63759143f63f791f1a03962db8329359e3eb2
Author: Olivier Fourdan <ofourdan redhat com>
Date: Wed Feb 1 15:09:52 2017 +0100
gdkwindow: subsurface in gdk_window_get_effective_parent()
When the GtkWidget hierarchy does not match the GdkWindow hierarchy, the
GtkWidget code may find a common ancestor that cannot be found while
traversing the GdkWindow tree using gdk_window_get_effective_parent().
This happens with for example on Wayland, a GtkPopover has another
GtkPopover as parent, in this case, the GdkWindow parent is the root
window, whereas the GtkWidget parent is the other GtkPopover.
That confuses the gtk_widget_translate_coordinates() logic which will
bail out in this case and won't return the translated coordinates.
Make gdk_window_get_effective_parent() aware of subsurfaces and use the
transient_for which represents the actual parent (whereas the parent
might be pointing to the root window).
Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=774148
gdk/gdkwindow.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 3f7c8c9..ac3229f 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -637,6 +637,12 @@ gdk_window_is_offscreen (GdkWindow *window)
return window->window_type == GDK_WINDOW_OFFSCREEN;
}
+static gboolean
+gdk_window_is_subsurface (GdkWindow *window)
+{
+ return window->window_type == GDK_WINDOW_SUBSURFACE;
+}
+
static GdkWindow *
gdk_window_get_impl_window (GdkWindow *window)
{
@@ -2429,6 +2435,8 @@ gdk_window_get_effective_parent (GdkWindow *window)
if (gdk_window_is_offscreen (window))
return gdk_offscreen_window_get_embedder (window);
+ else if (gdk_window_is_subsurface (window))
+ return window->transient_for;
else
return window->parent;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]