summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler@noemail.net>2017-11-30 06:07:09 (GMT)
committerculler <culler@noemail.net>2017-11-30 06:07:09 (GMT)
commit1db21f2c58b10a2db168636ebf69724460b49f75 (patch)
tree14bb105276ccbd94070319ebfe1ccae9edb2e4f9
parent2924e198fe2852c31ed4886b0963dcd60cc48062 (diff)
parent1fdfcfbce954d8afae8a06b2a1a1feb92f4f1861 (diff)
downloadtk-bug-164c1b1091.zip
tk-bug-164c1b1091.tar.gz
tk-bug-164c1b1091.tar.bz2
Merge bug-164c1b1091 into core-8-6-branch. Fixes behavior of raise on macOS.bug-164c1b1091
FossilOrigin-Name: 7b656ecf680da6631b59e4091c9e4ffd5f2075909276ce8081e7100a115363b6
-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 ...?");