[gtk/gtk-4-6] Merge branch 'sumibi-yakitori/fix-maximize-window-macos' into 'main'
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-4-6] Merge branch 'sumibi-yakitori/fix-maximize-window-macos' into 'main'
- Date: Sun, 3 Apr 2022 22:15:17 +0000 (UTC)
commit 029fc0fdef29dc3c29193b879ab76e7f15d74aa6
Author: Christian Hergert <christian hergert me>
Date: Sun Apr 3 22:14:52 2022 +0000
Merge branch 'sumibi-yakitori/fix-maximize-window-macos' into 'main'
macos: prohibit fullscreen transition if in transtion
This prevents performing additional fullscreen transitions while
a transition is already in progress.
Closes #4808
See merge request GNOME/gtk!4612
(cherry picked from commit 15b7a4572b3a06aefed75bb7989c711763af65f7)
69a0a5cf macos: Prohibit changing the full-screen state of a window during a full-screen transition
229e4b58 macos: Corrected code style
gdk/macos/GdkMacosWindow.c | 11 +++++++++++
gdk/macos/GdkMacosWindow.h | 2 ++
gdk/macos/gdkmacostoplevelsurface.c | 12 ++++++------
3 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/gdk/macos/GdkMacosWindow.c b/gdk/macos/GdkMacosWindow.c
index 23b3f5a3f3..0eb1ec7ca8 100644
--- a/gdk/macos/GdkMacosWindow.c
+++ b/gdk/macos/GdkMacosWindow.c
@@ -171,6 +171,11 @@ typedef NSString *CALayerContentsGravity;
return inMove;
}
+- (BOOL)inFullscreenTransition;
+{
+ return inFullscreenTransition;
+}
+
-(void)checkSendEnterNotify
{
/* When a new window has been created, and the mouse is in the window
@@ -759,31 +764,37 @@ typedef NSString *CALayerContentsGravity;
-(void)windowWillEnterFullScreen:(NSNotification *)aNotification
{
+ inFullscreenTransition = YES;
lastUnfullscreenFrame = [self frame];
}
-(void)windowDidEnterFullScreen:(NSNotification *)aNotification
{
+ inFullscreenTransition = NO;
initialPositionKnown = NO;
[self checkSendEnterNotify];
}
-(void)windowWillExitFullScreen:(NSNotification *)aNotification
{
+ inFullscreenTransition = YES;
}
-(void)windowDidExitFullScreen:(NSNotification *)aNotification
{
+ inFullscreenTransition = NO;
initialPositionKnown = NO;
[self checkSendEnterNotify];
}
-(void)windowDidFailToEnterFullScreen:(NSNotification *)aNotification
{
+ inFullscreenTransition = NO;
}
-(void)windowDidFailToExitFullScreen:(NSNotification *)aNotification
{
+ inFullscreenTransition = NO;
}
-(void)windowDidChangeScreen:(NSNotification *)aNotification
diff --git a/gdk/macos/GdkMacosWindow.h b/gdk/macos/GdkMacosWindow.h
index 3a514ea857..1cf9ec805c 100644
--- a/gdk/macos/GdkMacosWindow.h
+++ b/gdk/macos/GdkMacosWindow.h
@@ -53,6 +53,7 @@
NSRect lastMaximizedFrame;
NSRect lastUnfullscreenFrame;
BOOL inMaximizeTransition;
+ BOOL inFullscreenTransition;
}
-(void)beginManualMove;
@@ -70,5 +71,6 @@
-(void)setDecorated:(BOOL)decorated;
-(void)swapBuffer:(GdkMacosBuffer *)buffer withDamage:(const cairo_region_t *)damage;
-(BOOL)needsMouseDownQuirk;
+-(BOOL)inFullscreenTransition;
@end
diff --git a/gdk/macos/gdkmacostoplevelsurface.c b/gdk/macos/gdkmacostoplevelsurface.c
index 1759077563..aa828fcfa5 100644
--- a/gdk/macos/gdkmacostoplevelsurface.c
+++ b/gdk/macos/gdkmacostoplevelsurface.c
@@ -33,26 +33,26 @@
static void
_gdk_macos_toplevel_surface_fullscreen (GdkMacosToplevelSurface *self)
{
- NSWindow *window;
+ GdkMacosWindow *window;
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (self));
- window = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (self));
+ window = (GdkMacosWindow *)_gdk_macos_surface_get_native (GDK_MACOS_SURFACE (self));
- if (([window styleMask] & NSWindowStyleMaskFullScreen) == 0)
+ if (![window inFullscreenTransition] && ([window styleMask] & NSWindowStyleMaskFullScreen) == 0)
[window toggleFullScreen:window];
}
static void
_gdk_macos_toplevel_surface_unfullscreen (GdkMacosToplevelSurface *self)
{
- NSWindow *window;
+ GdkMacosWindow *window;
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (self));
- window = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (self));
+ window = (GdkMacosWindow *)_gdk_macos_surface_get_native (GDK_MACOS_SURFACE (self));
- if (([window styleMask] & NSWindowStyleMaskFullScreen) != 0)
+ if (![window inFullscreenTransition] && ([window styleMask] & NSWindowStyleMaskFullScreen) != 0)
[window toggleFullScreen:window];
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]