[gtk/wip/chergert/macos-iosurface: 15/21] macos: allow windows to enter fullscreen
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/macos-iosurface: 15/21] macos: allow windows to enter fullscreen
- Date: Tue, 22 Feb 2022 04:55:53 +0000 (UTC)
commit 88a1175045ad14db68b7d31638ce38f1beccfd3b
Author: Christian Hergert <christian hergert me>
Date: Fri Feb 18 01:52:48 2022 -0800
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 fb81c0313a..3f45bc8d4c 100644
--- a/gdk/macos/GdkMacosWindow.c
+++ b/gdk/macos/GdkMacosWindow.c
@@ -746,12 +746,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 bb2a77f256..862eb8f1e9 100644
--- a/gdk/macos/gdkmacostoplevelsurface.c
+++ b/gdk/macos/gdkmacostoplevelsurface.c
@@ -690,6 +690,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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]