From fe7fd146aa2ab683632f64de0d3f154c7df7362d Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 10 Apr 2024 17:21:31 +0200 Subject: [PATCH] macOS: fix crash when trying to enter fullscreen while already in fullscreen YDK2 uses SetSystemUIMode() for fullscreen. This also uses space otherwise reserved for the menu bar at the top, and is apparently preferable for Ardour's UI. However when a user manually enters fullscreen using the window title-bar's green button (NSWindow toggleFullScreen). YDK will crash when the user then also tries to use YDK's fullscreen mode: ``` NSWindowStyleMaskFullScreen cleared on a window outside of a full screen transition. called from [NSWindow setStyleMask:] gdk_window_set_decorations gdk_window_fullscreen ``` Ideally we'd set NSApp presentation flags so that the toplevel window would allow one to zoom (maximize), but not to enter fullscreen. Like it used to be on OSX. It is unclear how to achieve this on macOS for resizable windows, short of marking the top-level window a dialog or utility window. --- libs/tk/ydk/quartz/gdkwindow-quartz.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/tk/ydk/quartz/gdkwindow-quartz.c b/libs/tk/ydk/quartz/gdkwindow-quartz.c index b7d9afeb8c..b8a6f2e098 100644 --- a/libs/tk/ydk/quartz/gdkwindow-quartz.c +++ b/libs/tk/ydk/quartz/gdkwindow-quartz.c @@ -2826,6 +2826,13 @@ gdk_window_fullscreen (GdkWindow *window) !WINDOW_IS_TOPLEVEL (window)) return; + if ([impl->toplevel styleMask] & NSWindowStyleMaskFullScreen) { + /* already in full screen, this can happen when a user + * uses the "green button" to maximize the window. + */ + return; + } + geometry = get_fullscreen_geometry (window); if (!geometry) {