summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-12-29 15:54:32 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-12-29 15:54:32 +0100
commit7e4306af6bd002d2063a991e9c8b9c1db05da99e (patch)
tree77f66b3150654af1570b3969ebfb199a1dc0360d /src
parent83d9a2c63dc168e1e503900ef6c4a1680f16fc54 (diff)
Fix "Focus is lost leaving full screen on macOS 13" (#608)
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 92bb6c2fd..81178d2f0 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -3155,12 +3155,14 @@ void Fl_Cocoa_Window_Driver::fullscreen_off(int X, int Y, int W, int H) {
H is larger than the maximum value for the display.
See "Crashing regression in MacOS code" in fltk.coredev.
*/
+ BOOL has_focus = [nswin isKeyWindow];
[nswin orderOut:nil];
[nswin setLevel:level];
[nswin setStyleMask:calc_win_style(pWindow)]; //10.6
restore_window_title_and_icon(pWindow, icon_image);
pWindow->resize(X, Y, W, H);
- [nswin orderFront:nil];
+ if (has_focus) [nswin makeKeyAndOrderFront:nil];
+ else [nswin orderFront:nil];
} else
#endif
{