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.
This commit is contained in:
Robin Gareus 2024-04-10 17:21:31 +02:00
parent 6b3fbefd26
commit fe7fd146aa
1 changed files with 7 additions and 0 deletions

View File

@ -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)
{