From 7e4306af6bd002d2063a991e9c8b9c1db05da99e Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Thu, 29 Dec 2022 15:54:32 +0100 Subject: Fix "Focus is lost leaving full screen on macOS 13" (#608) --- src/Fl_cocoa.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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 { -- cgit v1.2.3