[gtk/wip/chergert/quartz4u] macos: tweak initial placement of CSD windows



commit c575fb4791299d765e83f15f4f1e397fa62b7012
Author: Christian Hergert <chergert redhat com>
Date:   Wed May 20 10:13:31 2020 -0700

    macos: tweak initial placement of CSD windows
    
    Currently, they show with an offset just so the shadow can be displayed.
    That isn't really ideal (although showing everything in the topleft corner
    isnt really ideal either).
    
    Given that we don't really tell applications to do window placement on
    other platforms, I'm not sure what the right answer here is. We might
    want to do some rudimentary placement of windows since Quartz
    doesn't seem to be doing that for us.

 gdk/macos/gdkmacostoplevelsurface.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/gdk/macos/gdkmacostoplevelsurface.c b/gdk/macos/gdkmacostoplevelsurface.c
index 6de799914b..66a83958ed 100644
--- a/gdk/macos/gdkmacostoplevelsurface.c
+++ b/gdk/macos/gdkmacostoplevelsurface.c
@@ -144,6 +144,25 @@ _gdk_macos_toplevel_surface_present (GdkToplevel       *toplevel,
   else
     _gdk_macos_toplevel_surface_unfullscreen (self);
 
+  if (GDK_SURFACE (self)->transient_for != NULL)
+    {
+    }
+  else
+    {
+      if (!self->decorated &&
+          !GDK_MACOS_SURFACE (self)->did_initial_present &&
+          GDK_SURFACE (self)->x == 0 &&
+          GDK_SURFACE (self)->y == 0 &&
+          (GDK_MACOS_SURFACE (self)->shadow_left ||
+           GDK_MACOS_SURFACE (self)->shadow_top))
+        {
+          int x = GDK_SURFACE (self)->x - GDK_MACOS_SURFACE (self)->shadow_left;
+          int y = GDK_SURFACE (self)->y - GDK_MACOS_SURFACE (self)->shadow_top;
+
+          _gdk_macos_surface_move (GDK_MACOS_SURFACE (self), x, y);
+        }
+    }
+
   _gdk_macos_surface_show (GDK_MACOS_SURFACE (self));
 
   GDK_MACOS_SURFACE (self)->did_initial_present = TRUE;


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