summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2017-11-29 20:57:39 (GMT)
committerculler <culler>2017-11-29 20:57:39 (GMT)
commitc668bc71f2cd2d52ff7db3d0c38e3cfad1dad58e (patch)
treed664b3d6ad1d2c4c8121f4881f251e68c1040f4e
parenta39f501d79c524995811455bd9a8b41e9f40b807 (diff)
downloadtk-c668bc71f2cd2d52ff7db3d0c38e3cfad1dad58e.zip
tk-c668bc71f2cd2d52ff7db3d0c38e3cfad1dad58e.tar.gz
tk-c668bc71f2cd2d52ff7db3d0c38e3cfad1dad58e.tar.bz2
Fix behavior of raise on macOS.
-rw-r--r--macosx/tkMacOSXEmbed.c2
-rw-r--r--macosx/tkMacOSXWm.c66
2 files changed, 37 insertions, 31 deletions
diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c
index edcd064..bda4c7c 100644
--- a/macosx/tkMacOSXEmbed.c
+++ b/macosx/tkMacOSXEmbed.c
@@ -800,7 +800,7 @@ ContainerEventProc(
Tk_ErrorHandler errHandler;
if (!firstContainerPtr) {
- TKLog(@"Embedded window has nil container.");
+ TkMacOSXDbgMsg("Embedded window has nil container.");
return;
}
/*
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 3ecb651..c8afada 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -4674,44 +4674,50 @@ TkWmRestackToplevel(
* below *all* siblings. */
{
NSWindow *macWindow;
- NSInteger otherMacWindowNumber;
-
+ NSWindow *otherMacWindow;
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ int macAboveBelow = (aboveBelow == Above ? NSWindowAbove : NSWindowBelow);
+ int otherNumber = 0; /* 0 will be used when otherPtr is NULL. */
+
/*
- * Get the mac window. Make sure it exists & is mapped.
+ * If the Tk windows has no drawable, or is withdrawn do nothing.
*/
-
- if (winPtr->window == None) {
- Tk_MakeWindowExist((Tk_Window) winPtr);
+ if (winPtr->window == None ||
+ wmPtr == NULL ||
+ wmPtr->hints.initial_state == WithdrawnState) {
+ return;
}
- if (winPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
+ macWindow = TkMacOSXDrawableWindow(winPtr->window);
+ if (macWindow == nil) {
+ return;
+ }
+ if (otherPtr) {
/*
- * Can't set stacking order properly until the window is on the screen
- * (mapping it may give it a reparent window), so make sure it's on
- * the screen.
+ * When otherPtr is non-NULL, if the other window has no
+ * drawable or is withdrawn, do nothing.
*/
-
- TkWmMapWindow(winPtr);
+ WmInfo *otherWmPtr = otherPtr->wmInfoPtr;
+ if (winPtr->window == None ||
+ otherWmPtr == NULL ||
+ otherWmPtr->hints.initial_state == WithdrawnState) {
+ return;
+ }
+ otherMacWindow = TkMacOSXDrawableWindow(otherPtr->window);
+ if (otherMacWindow == nil) {
+ return;
+ } else {
+ /*
+ * If the other window is OK, get its number.
+ */
+ otherNumber = [otherMacWindow windowNumber];
+ }
}
- macWindow = TkMacOSXDrawableWindow(winPtr->window);
/*
- * Get the window in which a raise or lower is in relation to.
+ * Just let the Mac window manager deal with all the subtleties
+ * of keeping track of off-screen windows, etc.
*/
-
- if (otherPtr != NULL) {
- if (otherPtr->window == None) {
- Tk_MakeWindowExist((Tk_Window) otherPtr);
- }
- if (otherPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
- TkWmMapWindow(otherPtr);
- }
- otherMacWindowNumber = [TkMacOSXDrawableWindow(otherPtr->window)
- windowNumber];
- } else {
- otherMacWindowNumber = 0;
- }
- [macWindow orderWindow:(aboveBelow == Above ? NSWindowAbove : NSWindowBelow)
- relativeTo:otherMacWindowNumber];
+ [macWindow orderWindow:macAboveBelow relativeTo:otherNumber];
}
/*
@@ -5237,7 +5243,7 @@ TkUnsupported1ObjCmd(
};
Tk_Window tkwin = clientData;
TkWindow *winPtr;
- int index, i;
+ int index;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?");