diff options
author | dgp <dgp@noemail.net> | 2013-01-03 13:43:47 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2013-01-03 13:43:47 (GMT) |
commit | 37117ba1534622821d65bac05a671d0cb943d4f1 (patch) | |
tree | f74b2c93a97ed16111f5a7e3cbe6244e42ce680e | |
parent | 0552fa9a17efc84390cf756af59529ed56f02e76 (diff) | |
parent | eeda41b8bd9c9e30d74cc7818f254e602558dccd (diff) | |
download | tk-37117ba1534622821d65bac05a671d0cb943d4f1.zip tk-37117ba1534622821d65bac05a671d0cb943d4f1.tar.gz tk-37117ba1534622821d65bac05a671d0cb943d4f1.tar.bz2 |
merge 8.5
FossilOrigin-Name: c544ca019f51ab8790c85034d8abf1c996b976a7
-rw-r--r-- | macosx/tkMacOSXWm.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 45f0fd5..cb6e3c4 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -321,6 +321,10 @@ static void GetMaxSize(TkWindow *winPtr, int *maxWidthPtr, static void RemapWindows(TkWindow *winPtr, MacDrawable *parentWin); +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 +#define TK_GOT_AT_LEAST_SNOW_LEOPARD 1 +#endif + #pragma mark TKWindow(TKWm) #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 @@ -4539,7 +4543,7 @@ TkWmAddToColormapWindows( * add the toplevel itself as the last element of the list. */ - newPtr = ckalloc((count+2) * sizeof(TkWindow *)); + newPtr = (TkWindow**)ckalloc((count+2) * sizeof(TkWindow *)); if (count > 0) { memcpy(newPtr, oldPtr, count * sizeof(TkWindow *)); } @@ -5438,10 +5442,14 @@ TkMacOSXMakeRealWindowExist( /* Set background color and opacity of window if those flags are set. */ if (colorName != NULL) { [window setBackgroundColor: colorName]; - } + } if (opaqueTag != NULL) { +#ifdef TK_GOT_AT_LEAST_SNOW_LEOPARD [window setOpaque: opaqueTag]; +#else + [window setOpaque: YES]; +#endif } [window setDocumentEdited:NO]; @@ -5942,7 +5950,7 @@ TkWmStackorderToplevel( Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); WmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); - windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *)); + windows = (TkWindow**)ckalloc((table.numEntries+1) * sizeof(TkWindow *)); /* * Special cases: If zero or one toplevels were mapped there is no need to @@ -5967,7 +5975,7 @@ TkWmStackorderToplevel( } else { window_ptr = windows + table.numEntries; *window_ptr-- = NULL; - windowNumbers = ckalloc(windowCount * sizeof(NSInteger)); + windowNumbers = (NSInteger*)ckalloc(windowCount * sizeof(NSInteger)); NSWindowList(windowCount, windowNumbers); for (NSInteger index = 0; index < windowCount; index++) { NSWindow *w = [NSApp windowWithWindowNumber:windowNumbers[index]]; @@ -6286,7 +6294,9 @@ TkMacOSXMakeFullscreen( WmInfo *wmPtr = winPtr->wmInfoPtr; int result = TCL_OK, wasFullscreen = (wmPtr->flags & WM_FULLSCREEN); +#ifdef TK_GOT_AT_LEAST_SNOW_LEOPARD static unsigned long prevMask = 0, prevPres = 0; +#endif /*TK_GOT_AT_LEAST_SNOW_LEOPARD*/ if (fullscreen) { int screenWidth = WidthOfScreen(Tk_Screen(winPtr)); @@ -6325,15 +6335,26 @@ TkMacOSXMakeFullscreen( wmPtr->flags |= WM_FULLSCREEN; } +#ifdef TK_GOT_AT_LEAST_SNOW_LEOPARD + /* + * We can't set these features on Leopard or earlier, as they don't + * exist (neither options nor API that uses them). This formally means + * that there's a bug with full-screen windows with Tk on old OSX, but + * it isn't worth blocking a build just for this. + */ + prevMask = [window styleMask]; prevPres = [NSApp presentationOptions]; [window setStyleMask: NSBorderlessWindowMask]; [NSApp setPresentationOptions: NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar]; +#endif /*TK_GOT_AT_LEAST_SNOW_LEOPARD*/ } else { wmPtr->flags &= ~WM_FULLSCREEN; +#ifdef TK_GOT_AT_LEAST_SNOW_LEOPARD [NSApp setPresentationOptions: prevPres]; [window setStyleMask: prevMask]; +#endif /*TK_GOT_AT_LEAST_SNOW_LEOPARD*/ } if (wasFullscreen && !(wmPtr->flags & WM_FULLSCREEN)) { |