diff options
author | John Ralls <jralls@ceridwen.us> | 2019-02-19 15:12:15 -0800 |
---|---|---|
committer | John Ralls <jralls@ceridwen.us> | 2019-03-03 20:05:13 -0800 |
commit | 03c5b92da2b9b1bcd23dc99e08f4c1518ac0c446 (patch) | |
tree | 4e8d0a93826e5b4672d2c3fa2c40ec066d871203 | |
parent | 512da667616af4c3d29f38bf658c8bbe8ad63973 (diff) | |
download | gtk+-03c5b92da2b9b1bcd23dc99e08f4c1518ac0c446.tar.gz |
[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
-rw-r--r-- | gdk/quartz/gdkwindow-quartz.c | 34 |
1 files changed, 33 insertions, 1 deletions
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 @@ -2170,6 +2170,37 @@ _gdk_quartz_window_update_has_shadow (GdkWindowImplQuartz *impl) } 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]; |