[gtk/translate-geometry] gdk/wayland: Control translate from parent geometry



commit 842599e0f9aa0cf2e43a0d140d78844e1a03d668
Author: Alberto Fanjul <albertofanjul gmail com>
Date:   Wed Mar 25 23:23:18 2020 +0100

    gdk/wayland: Control translate from parent geometry
    
    offscreen windows return NULL for its parent

 gdk/wayland/gdkwindow-wayland.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index c699025027..e863e568e8 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -2181,7 +2181,7 @@ get_real_parent_and_translate (GdkWindow *window,
         GDK_WINDOW_IMPL_WAYLAND (parent->impl);
       GdkWindow *effective_parent = gdk_window_get_effective_parent (parent);
 
-      if ((gdk_window_has_native (parent) &&
+      if (parent == NULL || (gdk_window_has_native (parent) &&
            !parent_impl->display_server.wl_subsurface) ||
           !effective_parent)
         break;
@@ -2208,8 +2208,10 @@ translate_to_real_parent_window_geometry (GdkWindow  *window,
 
   parent = get_real_parent_and_translate (window, x, y);
 
-  *x -= parent->shadow_left;
-  *y -= parent->shadow_top;
+  if (parent != NULL) {
+    *x -= parent->shadow_left;
+    *y -= parent->shadow_top;
+  }
 }
 
 static GdkWindow *
@@ -2223,8 +2225,13 @@ translate_from_real_parent_window_geometry (GdkWindow *window,
 
   parent = get_real_parent_and_translate (window, &dx, &dy);
 
-  *x -= dx - parent->shadow_left;
-  *y -= dy - parent->shadow_top;
+  *x -= dx;
+  *y -= dy;
+
+  if (parent != NULL) {
+    *x += parent->shadow_left;
+    *y += parent->shadow_top;
+  }
 
   return parent;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]