FLTK logo

[branch-1.3] bc2f1f6 - Fix fullscreen window level corner cases on macOS - cont'd

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[branch-1.3] bc2f1f6 - Fix fullscreen window level corner cases on macOS - cont'd "ManoloFLTK" Dec 29, 2021  
 
commit bc2f1f681815e5b81bdc98d13222e5f0c5c6a025
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Wed Dec 29 17:07:35 2021 +0100
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Wed Dec 29 17:07:53 2021 +0100

    Fix fullscreen window level corner cases on macOS - cont'd
    
    See long discussion in PR#277 at
    https://github.com/fltk/fltk/pull/277

 src/Fl_cocoa.mm | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git src/Fl_cocoa.mm src/Fl_cocoa.mm
index e53f496..3ce77f9 100644
--- src/Fl_cocoa.mm
+++ src/Fl_cocoa.mm
@@ -977,8 +977,8 @@ static NSInteger modal_window_level(void)
   NSInteger level;
 
   level = max_normal_window_level();
-  if (level < NSModalPanelWindowLevel)
-    return NSModalPanelWindowLevel;
+  if (level < NSStatusWindowLevel)
+    return NSStatusWindowLevel;
 
   // Need some room for non-modal windows
   level += 2;
@@ -1482,9 +1482,8 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
   FLWindow *nsw = (FLWindow*)[notif object];
   Fl_Window *window = [nsw getFl_Window];
   /* Fullscreen windows obscure all other windows so we need to return
-   to a "normal" level when the user switches to another window,
-   unless this other window is above the fullscreen window */
-  if (window->fullscreen_active() && [NSApp keyWindow] && [[NSApp keyWindow] level] <= [nsw level]) {
+   to a "normal" level when the user switches to another window or other app */
+  if (window->fullscreen_active()) {
     [nsw setLevel:NSNormalWindowLevel];
     fixup_window_levels();
   }
@@ -3098,7 +3097,15 @@ void Fl_Window::fullscreen_x() {
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
     [i->xid setStyleMask:NSBorderlessWindowMask]; //10.6
 #endif
-    [i->xid setLevel:NSStatusWindowLevel];
+    if ([i->xid isKeyWindow]) {
+       if ([i->xid level] != NSStatusWindowLevel) {
+         [i->xid setLevel:NSStatusWindowLevel];
+         fixup_window_levels();
+       }
+    } else if([i->xid level] != NSNormalWindowLevel) {
+       [i->xid setLevel:NSNormalWindowLevel];
+       fixup_window_levels();
+    }
     int sx, sy, sw, sh, X, Y, W, H;
     int top = fullscreen_screen_top;
     int bottom = fullscreen_screen_bottom;
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.