From bfdae6d151fd556df11d88559f7f386bec8af56a Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 27 Jan 2025 18:54:29 +0100 Subject: [PATCH] Fix crash in test/fullscreen under macOS Operations that produced the crash: 1. press "FullScreen" or green button; 2. press "All Screens" --- src/Fl_cocoa.mm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index b2195a432..a41fc4989 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -3133,6 +3133,18 @@ void Fl_Window::fullscreen_x() { [i->xid toggleFullScreen:nil]; # endif } else if (fl_mac_os_version >= 100600) { +# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + if (fl_mac_os_version >= 100700 && (i->xid.styleMask & NSWindowStyleMaskFullScreen)) { + [i->xid toggleFullScreen:nil]; + if (no_fullscreen_w == 0) { + no_fullscreen_x = x(); + no_fullscreen_y = y(); + no_fullscreen_w = w(); + no_fullscreen_h = h(); + } + _set_fullscreen(); + } +#endif [i->xid setStyleMask:NSBorderlessWindowMask]; // 10.6 if ([i->xid isKeyWindow]) { if ([i->xid level] != NSStatusWindowLevel) {