summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2020-07-22 20:52:47 (GMT)
committerculler <culler>2020-07-22 20:52:47 (GMT)
commit8355f067aeedc09f978725b0c5956924ac3542bc (patch)
treeededd32303c11db234fc490a73e5305e390fc6f5
parent06178b77e52e18e6f3bafc4fee9f4049348b1292 (diff)
downloadtk-8355f067aeedc09f978725b0c5956924ac3542bc.zip
tk-8355f067aeedc09f978725b0c5956924ac3542bc.tar.gz
tk-8355f067aeedc09f978725b0c5956924ac3542bc.tar.bz2
Fix issues with mapping and unmapping windows revealed by tests on Yosemite.
-rw-r--r--macosx/tkMacOSXSubwindows.c2
-rw-r--r--macosx/tkMacOSXWindowEvent.c3
-rw-r--r--macosx/tkMacOSXWm.c14
-rw-r--r--tests/pack.test19
4 files changed, 17 insertions, 21 deletions
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 8bae8fd..030830d 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -206,6 +206,7 @@ XMapWindow(
event.xmap.event = window;
event.xmap.override_redirect = winPtr->atts.override_redirect;
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {}
} else {
/*
@@ -316,6 +317,7 @@ XUnmapWindow(
event.xunmap.event = window;
event.xunmap.from_configure = false;
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {}
} else {
/*
* Rebuild the visRgn clip region for the parent so it will be allowed
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 5f52ea7..3f0e52f 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -117,8 +117,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
* Process all Tk events generated by Tk_MapWindow().
*/
- while (Tcl_ServiceEvent(0)) {}
- while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {}
/*
* NSWindowDidDeminiaturizeNotification is received after
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index dca8686..abaf152 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -1807,7 +1807,6 @@ WmDeiconifyCmd(
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
-
if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't deiconify %s: it is an icon for %s",
@@ -6422,16 +6421,9 @@ TkpWmSetState(
Tk_UnmapWindow((Tk_Window) winPtr);
} else if (state == NormalState || state == ZoomState) {
Tk_MapWindow((Tk_Window) winPtr);
- if (macWin && ([macWin styleMask] & NSMiniaturizableWindowMask)) {
- if ([macWin isMiniaturized]) {
- [macWin deminiaturize:NSApp];
- }
- else {
- [macWin orderFront:nil];
- }
- }
- TkMacOSXZoomToplevel(macWin, state == NormalState ? inZoomIn :
- inZoomOut);
+ [macWin deminiaturize:NSApp];
+ [macWin orderFront:NSApp];
+ TkMacOSXZoomToplevel(macWin, state == NormalState ? inZoomIn : inZoomOut);
}
}
diff --git a/tests/pack.test b/tests/pack.test
index b1c22c7..04e84b9 100644
--- a/tests/pack.test
+++ b/tests/pack.test
@@ -1554,6 +1554,7 @@ test pack-18.1 {unmap slaves when master unmapped} -constraints {
tempNotPc
} -setup {
eval destroy [winfo child .pack]
+ update idletasks
} -body {
# adjust the position of .pack before test to avoid a screen switch
@@ -1561,25 +1562,27 @@ test pack-18.1 {unmap slaves when master unmapped} -constraints {
# as the screen (screen switch causes scale and other tests to fail).
wm geometry .pack +100+100
+ update idletasks
# On the PC, when the width/height is configured while the window is
# unmapped, the changes don't take effect until the window is remapped.
# Who knows why?
eval destroy [winfo child .pack]
+ update idletasks
frame .pack.a -width 100 -height 50 -relief raised -bd 2
pack .pack.a
- update
+ update idletasks
set result [winfo ismapped .pack.a]
wm iconify .pack
- update
+ update idletasks
lappend result [winfo ismapped .pack.a]
.pack.a configure -width 200 -height 75
- update
+ update idletasks
lappend result [winfo width .pack.a ] [winfo height .pack.a] \
[winfo ismapped .pack.a]
wm deiconify .pack
- update
+ update idletasks
lappend result [winfo ismapped .pack.a]
} -result {1 0 200 75 0 1}
test pack-18.2 {unmap slaves when master unmapped} -setup {
@@ -1595,17 +1598,17 @@ test pack-18.2 {unmap slaves when master unmapped} -setup {
frame .pack.b -width 70 -height 30 -relief sunken -bd 2
pack .pack.a
pack .pack.b -in .pack.a
- update
+ update idletasks
set result [winfo ismapped .pack.b]
wm iconify .pack
- update
+ update idletasks
lappend result [winfo ismapped .pack.b]
.pack.b configure -width 100 -height 30
- update
+ update idletasks
lappend result [winfo width .pack.b ] [winfo height .pack.b] \
[winfo ismapped .pack.b]
wm deiconify .pack
- update
+ update idletasks
lappend result [winfo ismapped .pack.b]
} -result {1 0 100 30 0 1}