diff options
author | culler <culler> | 2018-11-24 17:34:47 (GMT) |
---|---|---|
committer | culler <culler> | 2018-11-24 17:34:47 (GMT) |
commit | 2db4c62686d9cffcc479f4bc70652fad961eb244 (patch) | |
tree | 371475dd369d66c704160bc447025d1ca7ffaeec /macosx | |
parent | 6a5cd5ed2cdcb924125f10bd9229aa00d24a2694 (diff) | |
download | tk-2db4c62686d9cffcc479f4bc70652fad961eb244.zip tk-2db4c62686d9cffcc479f4bc70652fad961eb244.tar.gz tk-2db4c62686d9cffcc479f4bc70652fad961eb244.tar.bz2 |
Implement window:willUseFullScreenContentSize so fullscreen windows will really use the full screen.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXEntry.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 19 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 18 |
3 files changed, 38 insertions, 1 deletions
diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c index dfb9eb1..4ab3111 100644 --- a/macosx/tkMacOSXEntry.c +++ b/macosx/tkMacOSXEntry.c @@ -91,7 +91,7 @@ TkpDrawEntryBorderAndFocus( TkMacOSXDrawingContext dc; GC bgGC; Tk_Window tkwin = entryPtr->tkwin; - int oldWidth; + int oldWidth = 0; MacDrawable *macDraw = (MacDrawable *) d; const HIThemeFrameDrawInfo info = { .version = 0, diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index fa4a8ce..9503447 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -136,6 +136,20 @@ extern NSString *NSWindowDidOrderOffScreenNotification; } } +- (NSSize)window:(NSWindow *)window + willUseFullScreenContentSize:(NSSize)proposedSize +{ + + /* + * We don't need to change the proposed size, but we do need to + * implement this method. Otherwise the full screen window will + * be sized to the screen's visibleFrame, leaving black bands at + * the top and bottom. + */ + + return proposedSize; +} + - (void) windowEnteredFullScreen: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS @@ -261,14 +275,19 @@ extern NSString *NSWindowDidOrderOffScreenNotification; #define observe(n, s) \ [nc addObserver:self selector:@selector(s) name:(n) object:nil] + observe(NSWindowDidBecomeKeyNotification, windowActivation:); observe(NSWindowDidResignKeyNotification, windowActivation:); observe(NSWindowDidMoveNotification, windowBoundsChanged:); observe(NSWindowDidResizeNotification, windowBoundsChanged:); observe(NSWindowDidDeminiaturizeNotification, windowExpanded:); observe(NSWindowDidMiniaturizeNotification, windowCollapsed:); + +#if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070) observe(NSWindowDidEnterFullScreenNotification, windowEnteredFullScreen:); observe(NSWindowDidExitFullScreenNotification, windowExitedFullScreen:); +#endif + #ifdef TK_MAC_DEBUG_NOTIFICATIONS observe(NSWindowWillMoveNotification, windowDragStart:); observe(NSWindowWillStartLiveResizeNotification, windowLiveResize:); diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 9b379c0..29cf893 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -388,6 +388,7 @@ static void RemapWindows(TkWindow *winPtr, @implementation TKWindow: NSWindow +#if MAC_OS_X_VERSION_MAX_ALLOWED > 101100 - (void)toggleTabBar:(id)sender { TkWindow *winPtr = TkMacOSXGetTkWindow(self); @@ -398,6 +399,7 @@ static void RemapWindows(TkWindow *winPtr, [super toggleTabBar:sender]; TkMacOSXApplyWindowAttributes(macWin->winPtr, self); } +#endif @end @@ -1270,7 +1272,11 @@ WmSetAttribute( return TCL_ERROR; } if (boolean != ((wmPtr->flags & WM_FULLSCREEN) != 0)) { +#if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070) [macWindow toggleFullScreen:macWindow]; +#else + TKLog(@"The fullscreen attribute is ignored on this system.."); +#endif } break; case WMATT_MODIFIED: @@ -6357,6 +6363,18 @@ ApplyWindowAttributeFlagChanges( tkCanJoinAllSpacesAttribute | tkMoveToActiveSpaceAttribute)) || initial) { NSWindowCollectionBehavior b = NSWindowCollectionBehaviorDefault; + + /* + * This behavior, which makes the green button expand a window to + * full screen, was included in the default as of OSX 10.13. For + * uniformity we use the new default in all versions of the OS + * where the behavior exists. + */ + +#if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070) + b |= NSWindowCollectionBehaviorFullScreenPrimary; +#endif + if (newAttributes & tkCanJoinAllSpacesAttribute) { b |= NSWindowCollectionBehaviorCanJoinAllSpaces; } else if (newAttributes & tkMoveToActiveSpaceAttribute) { |