From 592436503cadbdf52f5012c8a93bb99d7d1fa36a Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 18 Feb 2022 01:52:48 -0800 Subject: [PATCH] macos: allow windows to enter fullscreen This fixes GTK's NSWindow for toplevels so that they are allowed to enter fullscreen. We were already handlign the state transitions from the setStyleMask: halper, but we didn't previously tell the window we are allowed to transition into that. There is a bit of a mismatch here in that GTK doesn't have any such flag that determines if a window is "allowed" by policy to enter fullscreen since window managers on Linux are free to do that at will. --- gdk/macos/GdkMacosWindow.c | 16 ++++++++++++++++ gdk/macos/gdkmacostoplevelsurface.c | 3 +++ 2 files changed, 19 insertions(+) diff --git a/gdk/macos/GdkMacosWindow.c b/gdk/macos/GdkMacosWindow.c index a30d1b71a1..deea0477f7 100644 --- a/gdk/macos/GdkMacosWindow.c +++ b/gdk/macos/GdkMacosWindow.c @@ -804,12 +804,28 @@ typedef NSString *CALayerContentsGravity; lastUnfullscreenFrame = [self frame]; } +-(void)windowDidEnterFullScreen:(NSNotification *)aNotification +{ + initialPositionKnown = NO; + [self checkSendEnterNotify]; +} + -(void)windowWillExitFullScreen:(NSNotification *)aNotification { [self setFrame:lastUnfullscreenFrame display:YES]; } -(void)windowDidExitFullScreen:(NSNotification *)aNotification +{ + initialPositionKnown = NO; + [self checkSendEnterNotify]; +} + +-(void)windowDidFailToEnterFullScreen:(NSNotification *)aNotification +{ +} + +-(void)windowDidFailToExitFullScreen:(NSNotification *)aNotification { } diff --git a/gdk/macos/gdkmacostoplevelsurface.c b/gdk/macos/gdkmacostoplevelsurface.c index 17b1cec708..a14644fceb 100644 --- a/gdk/macos/gdkmacostoplevelsurface.c +++ b/gdk/macos/gdkmacostoplevelsurface.c @@ -646,6 +646,9 @@ _gdk_macos_toplevel_surface_new (GdkMacosDisplay *display, defer:NO screen:screen]; + /* Allow NSWindow to go fullscreen */ + [window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; + self = g_object_new (GDK_TYPE_MACOS_TOPLEVEL_SURFACE, "display", display, "frame-clock", frame_clock,