From 364dfaf8022321dd1237149b774e2d3fc5bf3f41 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 16 Nov 2015 16:48:01 +0000 Subject: Mac OS. This simpler algorithm is just as good: remove the constraint altogether for subwindows; keep it unchanged for windows. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10913 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 0dbfa0fd5..4fede5d1e 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -649,12 +649,10 @@ void Fl::remove_timeout(Fl_Timeout_Handler cb, void* data) - (void)recursivelySendToSubwindows:(SEL)sel; - (void)setSubwindowFrame; - (void)checkSubwindowFrame; +- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 - (NSPoint)convertBaseToScreen:(NSPoint)aPoint; #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 -- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen; -#endif @end @implementation FLWindow @@ -771,26 +769,16 @@ void Fl::remove_timeout(Fl_Timeout_Handler cb, void* data) } } -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 /* With Mac OS 10.11 the green window button makes window fullscreen (covers system menu bar and dock). When there are subwindows, they are by default constrained not to cover the menu bar (this is arguably a Mac OS bug). - Overriding this method prevents them from having this constraint. + Overriding the constrainFrameRect:toScreen: method removes this constraint. */ - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen { - if (fl_mac_os_version >= 101100) { - NSWindow *p = self, *win; // compute win the toplevel window - while (p) { - win = p; - p = [win parentWindow]; - } - if ([win inLiveResize]) // inLiveResize requires 10.6 - return frameRect; - } - return [super constrainFrameRect:frameRect toScreen:screen]; // will prevent a window from covering the menu bar + if ([self parentWindow]) return frameRect; // do not constrain subwindows + return [super constrainFrameRect:frameRect toScreen:screen]; // will prevent a window from going above the menu bar } -#endif @end @interface FLApplication : NSObject -- cgit v1.2.3