macos: allow windows to enter fullscreen
authorChristian Hergert <christian@hergert.me>
Fri, 18 Feb 2022 09:52:48 +0000 (01:52 -0800)
committerChristian Hergert <christian@hergert.me>
Fri, 18 Feb 2022 09:54:10 +0000 (01:54 -0800)
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
gdk/macos/gdkmacostoplevelsurface.c

index a30d1b71a1c38dd08e3ee70cf2185d085ea46ea8..deea0477f7e00ef36656add76ddbab97278d776e 100644 (file)
@@ -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
 {
 }
 
index 17b1cec7085313ea840d7a613a0320f783e60d5a..a14644fcebb85c814f4a1c547bb70148f8110dab 100644 (file)
@@ -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,