From 00a9090dae24f29b7c6f950ce0ee494c89261256 Mon Sep 17 00:00:00 2001 From: mdejong Date: Thu, 8 Aug 2002 23:45:01 +0000 Subject: * tests/wm.test: Add deleteWindows at start of new transient tests so they do not fail if the toplevels already exist. * unix/tkUnixWm.c: Revert patch for Tk Bug #592201 which incorrectly removed numTransients member. --- ChangeLog | 9 +++++++++ tests/wm.test | 7 ++++++- unix/tkUnixWm.c | 22 ++++++++++++++++++---- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 04335c6..e1a4eba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,13 @@ +2002-08-08 Mo DeJong + + * tests/wm.test: Add deleteWindows at start of + new transient tests so they do not fail if the + toplevels already exist. + * unix/tkUnixWm.c: Revert patch for Tk Bug #592201 + which incorrectly removed numTransients member. + 2002-08-08 Joe English + * unix/tkUnixWm.c: * win/tkWinWm.c: * tests/wm.test: Fix for Tk Bug #592201 "wm transient fails with two diff --git a/tests/wm.test b/tests/wm.test index bb2cdc3..1694365 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: wm.test,v 1.17 2002/08/08 22:32:11 jenglish Exp $ +# RCS: @(#) $Id: wm.test,v 1.18 2002/08/08 23:45:01 mdejong Exp $ # This file tests window manager interactions that work across # platforms. Window manager tests that only work on a specific @@ -1375,6 +1375,7 @@ test wm-transient-6.2 { a withdrawn transient does not track # 7.1 and 7.2 added to catch (potential) future errors. # test wm-transient-7.1 {Destroying transient} { + deleteWindows toplevel .t toplevel .transient wm transient .transient .t @@ -1384,6 +1385,7 @@ test wm-transient-7.1 {Destroying transient} { } {} test wm-transient-7.2 {Destroying master} { + deleteWindows toplevel .t toplevel .transient wm transient .transient .t @@ -1394,6 +1396,7 @@ test wm-transient-7.2 {Destroying master} { } {} test wm-transient-7.3 {Reassign transient, destroy old master} { + deleteWindows toplevel .t1 toplevel .t2 toplevel .transient @@ -1405,6 +1408,7 @@ test wm-transient-7.3 {Reassign transient, destroy old master} { } {} test wm-transient-7.4 {Reassign transient, destroy new master} { + deleteWindows toplevel .t1 toplevel .t2 toplevel .transient @@ -1416,6 +1420,7 @@ test wm-transient-7.4 {Reassign transient, destroy new master} { } {} test wm-transient-7.5 {Reassign transient, destroy transient} { + deleteWindows toplevel .t1 toplevel .t2 toplevel .transient diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 227103b..ee920b9 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixWm.c,v 1.31 2002/08/08 22:32:11 jenglish Exp $ + * RCS: @(#) $Id: tkUnixWm.c,v 1.32 2002/08/08 23:45:01 mdejong Exp $ */ #include "tkPort.h" @@ -197,6 +197,7 @@ typedef struct TkWmInfo { char *clientMachine; /* String to store in WM_CLIENT_MACHINE * property, or NULL. */ int flags; /* Miscellaneous flags, defined below. */ + int numTransients; /* number of transients on this window */ struct TkWmInfo *nextPtr; /* Next in list of all top-level windows. */ } WmInfo; @@ -527,6 +528,7 @@ TkWmNewWindow(winPtr) wmPtr->winPtr = winPtr; wmPtr->reparent = None; wmPtr->masterPtr = NULL; + wmPtr->numTransients = 0; wmPtr->hints.flags = InputHint | StateHint; wmPtr->hints.input = True; wmPtr->hints.initial_state = NormalState; @@ -855,6 +857,7 @@ TkWmDeadWindow(winPtr) for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL; wmPtr2 = wmPtr2->nextPtr) { if (wmPtr2->masterPtr == winPtr) { + wmPtr->numTransients--; Tk_DeleteEventHandler((Tk_Window) wmPtr2->masterPtr, StructureNotifyMask, WmWaitMapProc, (ClientData) wmPtr2->winPtr); @@ -868,12 +871,18 @@ TkWmDeadWindow(winPtr) } } } + if (wmPtr->numTransients != 0) + panic("numTransients should be 0"); if (wmPtr->masterPtr != NULL) { wmPtr2 = wmPtr->masterPtr->wmInfoPtr; /* - * If we had a master, remove old map/unmap binding + * If we had a master, tell them that we aren't tied + * to them anymore */ + if (wmPtr2 != NULL) { + wmPtr2->numTransients--; + } Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr, StructureNotifyMask, WmWaitMapProc, (ClientData) winPtr); @@ -2990,8 +2999,11 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv) if (Tcl_GetString(objv[3])[0] == '\0') { if (masterPtr != NULL) { /* - * If we had a master, remove old map/unmap binding + * If we had a master, tell them that we aren't tied + * to them anymore */ + + masterPtr->wmInfoPtr->numTransients--; Tk_DeleteEventHandler((Tk_Window) masterPtr, StructureNotifyMask, WmWaitMapProc, (ClientData) winPtr); @@ -3051,7 +3063,9 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv) * transient states reflect the state of the master. */ - if (wmPtr->masterPtr != NULL) { + if (wmPtr->masterPtr == NULL) { + masterPtr->wmInfoPtr->numTransients++; + } else { Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr, StructureNotifyMask, WmWaitMapProc, (ClientData) winPtr); -- cgit v0.12