Fix fullscreen window level corner cases on macOS - cont'd

See long discussion in PR#277 at
https://github.com/fltk/fltk/pull/277
This commit is contained in:
ManoloFLTK
2021-12-29 17:18:12 +01:00
parent c8bb2a3585
commit eeb3e92eb2
+4 -5
View File
@@ -831,8 +831,8 @@ static NSInteger modal_window_level(void)
NSInteger level; NSInteger level;
level = max_normal_window_level(); level = max_normal_window_level();
if (level < NSModalPanelWindowLevel) if (level < NSStatusWindowLevel)
return NSModalPanelWindowLevel; return NSStatusWindowLevel;
// Need some room for non-modal windows // Need some room for non-modal windows
level += 2; level += 2;
@@ -1285,9 +1285,8 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
FLWindow *nsw = (FLWindow*)[notif object]; FLWindow *nsw = (FLWindow*)[notif object];
Fl_Window *window = [nsw getFl_Window]; Fl_Window *window = [nsw getFl_Window];
/* Fullscreen windows obscure all other windows so we need to return /* Fullscreen windows obscure all other windows so we need to return
to a "normal" level when the user switches to another window, to a "normal" level when the user switches to another window or another app */
unless this other window is above the fullscreen window */ if (window->fullscreen_active()) {
if (window->fullscreen_active() && [NSApp keyWindow] && [[NSApp keyWindow] level] <= [nsw level]) {
[nsw setLevel:NSNormalWindowLevel]; [nsw setLevel:NSNormalWindowLevel];
fixup_window_levels(); fixup_window_levels();
} }