[gtk/gtk-3-24: 1/2] [quartz] Full-screen only "normal" windows and splashscreens.



commit 03c5b92da2b9b1bcd23dc99e08f4c1518ac0c446
Author: John Ralls <jralls ceridwen us>
Date:   Tue Feb 19 15:12:15 2019 -0800

    [quartz] Full-screen only "normal" windows and splashscreens.
    
    So dialogs, pop-ups, etc. behave as expected when parent is in
    full-screen.
    
    Tiling is allowed for normal windows and splash screens and disallowed
    for others.
    Closes https://gitlab.gnome.org/GNOME/gtk/issues/1627

 gdk/quartz/gdkwindow-quartz.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
---
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index d2213f0592..e2e11adaa7 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -2169,6 +2169,37 @@ _gdk_quartz_window_update_has_shadow (GdkWindowImplQuartz *impl)
     [impl->toplevel setHasShadow: has_shadow];
 }
 
+static void
+_gdk_quartz_window_set_collection_behavior (NSWindow *nswindow,
+                                            GdkWindowTypeHint hint)
+{
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+     if (gdk_quartz_osx_version() >= GDK_OSX_LION)
+    {
+      /* Fullscreen Collection Behavior */
+      NSWindowCollectionBehavior behavior = [nswindow collectionBehavior];
+      switch (hint)
+        {
+        case GDK_WINDOW_TYPE_HINT_NORMAL:
+        case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
+          behavior &= ~(NSWindowCollectionBehaviorFullScreenAuxiliary &
+                        NSWindowCollectionBehaviorFullScreenDisallowsTiling);
+          behavior |= (NSWindowCollectionBehaviorFullScreenPrimary |
+                       NSWindowCollectionBehaviorFullScreenAllowsTiling);
+
+          break;
+        default:
+          behavior &= ~(NSWindowCollectionBehaviorFullScreenPrimary &
+                        NSWindowCollectionBehaviorFullScreenAllowsTiling);
+          behavior |= (NSWindowCollectionBehaviorFullScreenAuxiliary |
+                       NSWindowCollectionBehaviorFullScreenDisallowsTiling);
+          break;
+        }
+      [nswindow setCollectionBehavior:behavior];
+    }
+#endif
+}
+
 static void
 gdk_quartz_window_set_type_hint (GdkWindow        *window,
                                  GdkWindowTypeHint hint)
@@ -2188,6 +2219,8 @@ gdk_quartz_window_set_type_hint (GdkWindow        *window,
     return;
 
   _gdk_quartz_window_update_has_shadow (impl);
+  if (impl->toplevel)
+    _gdk_quartz_window_set_collection_behavior (impl->toplevel, hint);
   [impl->toplevel setLevel: window_type_hint_to_level (hint)];
   [impl->toplevel setHidesOnDeactivate: window_type_hint_to_hides_on_deactivate (hint)];
 }
@@ -2439,7 +2472,6 @@ gdk_quartz_window_set_decorations (GdkWindow       *window,
       if (new_mask == GDK_QUARTZ_BORDERLESS_WINDOW)
         {
           [impl->toplevel setContentSize:rect.size];
-          [impl->toplevel setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
         }
       else
         [impl->toplevel setFrame:rect display:YES];


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