macos: restore unfullscreen frame with style mask
authorChristian Hergert <christian@hergert.me>
Fri, 25 Feb 2022 06:31:42 +0000 (22:31 -0800)
committerChristian Hergert <chergert@redhat.com>
Wed, 16 Mar 2022 19:23:04 +0000 (12:23 -0700)
This doesn't give us appropriate results if we use the window delegate.
Instead, we need to adjust the frame at the same time we change the
style mask so that we end up in the same location.

gdk/macos/GdkMacosWindow.c

index f879decbc9598d6f5b33688862afc83b093443e1..3ed60cb049f79359cc4750e4b5798e6e4ea3c83b 100644 (file)
@@ -668,7 +668,12 @@ typedef NSString *CALayerContentsGravity;
   is_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
 
   if (was_fullscreen != is_fullscreen)
-    _gdk_macos_surface_update_fullscreen_state (gdk_surface);
+    {
+      if (was_fullscreen)
+        [self setFrame:lastUnfullscreenFrame display:NO];
+
+      _gdk_macos_surface_update_fullscreen_state (gdk_surface);
+    }
 
   if (was_opaque != is_opaque)
     {
@@ -753,7 +758,6 @@ typedef NSString *CALayerContentsGravity;
 
 -(void)windowWillExitFullScreen:(NSNotification *)aNotification
 {
-  [self setFrame:lastUnfullscreenFrame display:NO];
 }
 
 -(void)windowDidExitFullScreen:(NSNotification *)aNotification