From: Christian Hergert Date: Fri, 18 Feb 2022 09:52:48 +0000 (-0800) Subject: macos: allow windows to enter fullscreen X-Git-Tag: archive/raspbian/4.6.5+ds-1+rpi1~1^2~19^2~3^2~78^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=592436503cadbdf52f5012c8a93bb99d7d1fa36a;p=gtk4.git 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. --- 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,