summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormdejong <mdejong>2002-05-24 09:50:11 (GMT)
committermdejong <mdejong>2002-05-24 09:50:11 (GMT)
commitd492476def6462c9ac9cb921ac7301859a1b8eba (patch)
treebe1f7fe17390fe84a32e09b3bb937e0a17ddadad
parent5105a4f93e2bb99c8b9ef937420df48c8a649e85 (diff)
downloadtk-d492476def6462c9ac9cb921ac7301859a1b8eba.zip
tk-d492476def6462c9ac9cb921ac7301859a1b8eba.tar.gz
tk-d492476def6462c9ac9cb921ac7301859a1b8eba.tar.bz2
* mac/tkMacWm.c (Tk_WmCmd):
* tests/unixWm.test: Move wm transient checks over to wm.test so they will be run on all systems. * tests/wm.test: Add tests to check for error when an iconwindow is passed to the wm transient command. * unix/tkUnixWm.c (Tk_WmCmd): * win/tkWinWm.c (Tk_WmCmd): Raise an error if one of the windows passed to the wm transient command is an iconwindow for another toplevel.
-rw-r--r--ChangeLog12
-rw-r--r--mac/tkMacWm.c22
-rw-r--r--tests/unixWm.test8
-rw-r--r--tests/wm.test44
-rw-r--r--unix/tkUnixWm.c20
-rw-r--r--win/tkWinWm.c22
6 files changed, 117 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 37ccd2b..f2d0193 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2002-05-24 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * mac/tkMacWm.c (Tk_WmCmd):
+ * tests/unixWm.test: Move wm transient checks over
+ to wm.test so they will be run on all systems.
+ * tests/wm.test: Add tests to check for error when
+ an iconwindow is passed to the wm transient command.
+ * unix/tkUnixWm.c (Tk_WmCmd):
+ * win/tkWinWm.c (Tk_WmCmd): Raise an error if one
+ of the windows passed to the wm transient command
+ is an iconwindow for another toplevel.
+
2002-05-23 Mo DeJong <mdejong@users.sourceforge.net>
* mac/tkMacWm.c (TkWmStackorderToplevelWrapperMap):
diff --git a/mac/tkMacWm.c b/mac/tkMacWm.c
index 1d2a8c5..ae2cfc5 100644
--- a/mac/tkMacWm.c
+++ b/mac/tkMacWm.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacWm.c,v 1.16 2002/05/23 19:55:18 mdejong Exp $
+ * RCS: @(#) $Id: tkMacWm.c,v 1.17 2002/05/24 09:50:11 mdejong Exp $
*/
#include <Gestalt.h>
@@ -1744,6 +1744,7 @@ Tk_WmCmd(
} else if ((c == 't') && (strncmp(argv[1], "transient", length) == 0)
&& (length >= 3)) {
Tk_Window master;
+ WmInfo *wmPtr2;
if ((argc != 3) && (argc != 4)) {
Tcl_AppendResult(interp, "wrong # arguments: must be \"",
@@ -1769,6 +1770,25 @@ Tk_WmCmd(
return TCL_ERROR;
}
Tk_MakeWindowExist(master);
+
+ if (wmPtr->iconFor != NULL) {
+ Tcl_AppendResult(interp, "can't make \"", argv[2],
+ "\" a transient: it is an icon for ",
+ Tk_PathName(wmPtr->iconFor),
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ wmPtr2 = ((TkWindow *) master)->wmInfoPtr;
+
+ if (wmPtr2->iconFor != NULL) {
+ Tcl_AppendResult(interp, "can't make \"", argv[3],
+ "\" a master: it is an icon for ",
+ Tk_PathName(wmPtr2->iconFor),
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+
wmPtr->master = Tk_WindowId(master);
wmPtr->masterWindowName = ckalloc((unsigned) (strlen(argv[3])+1));
strcpy(wmPtr->masterWindowName, argv[3]);
diff --git a/tests/unixWm.test b/tests/unixWm.test
index 2cf9ad3..ae675a4 100644
--- a/tests/unixWm.test
+++ b/tests/unixWm.test
@@ -7,7 +7,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: unixWm.test,v 1.14 2001/12/04 03:07:43 mdejong Exp $
+# RCS: @(#) $Id: unixWm.test,v 1.15 2002/05/24 09:50:11 mdejong Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
@@ -1262,12 +1262,6 @@ test unixWm-36.2 {Tk_WmCmd procedure, "title" option} {unixOnly} {
lappend result [wm title .t] [testprop [testwrapper .t] WM_NAME]
} {t t {Test window} {Test window}}
-test unixWm-37.1 {Tk_WmCmd procedure, "transient" option} {
- list [catch {wm transient .t 1 2} msg] $msg
-} {1 {wrong # arguments: must be "wm transient window ?master?"}}
-test unixWm-37.2 {Tk_WmCmd procedure, "transient" option} {
- list [catch {wm transient .t foo} msg] $msg
-} {1 {bad window path name "foo"}}
test unixWm-37.3 {Tk_WmCmd procedure, "transient" option} {unixOnly} {
set result {}
catch {destroy .t2}
diff --git a/tests/wm.test b/tests/wm.test
index 7dc6970..0665bcc 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.4 2002/05/23 19:55:18 mdejong Exp $
+# RCS: @(#) $Id: wm.test,v 1.5 2002/05/24 09:50:11 mdejong Exp $
# This file tests window manager interactions that work across
# platforms. Window manager tests that only work on a specific
@@ -303,6 +303,48 @@ test wm-stackorder-6.1 {An embedded toplevel does not
} {. .real}
+test wm-transient-1.1 {usage} {
+ catch {destroy .t} ; toplevel .t
+ list [catch {wm transient .t 1 2} msg] $msg
+} {1 {wrong # arguments: must be "wm transient window ?master?"}}
+
+test wm-transient-1.2 {usage} {
+ catch {destroy .t} ; toplevel .t
+ list [catch {wm transient .t foo} msg] $msg
+} {1 {bad window path name "foo"}}
+
+test wm-transient-1.3 {usage} {
+ catch {destroy .t} ; toplevel .t
+ list [catch {wm transient foo .t} msg] $msg
+} {1 {bad window path name "foo"}}
+
+test wm-transient-1.4 {usage} {
+ deleteWindows
+ toplevel .master
+ toplevel .subject
+ wm transient .subject .master
+ list [catch {wm iconify .subject} msg] $msg
+} {1 {can't iconify ".subject": it is a transient}}
+
+test wm-transient-1.5 {usage} {
+ deleteWindows
+ toplevel .icon -bg blue
+ toplevel .top
+ wm iconwindow .top .icon
+ toplevel .dummy
+ list [catch {wm transient .icon .dummy} msg] $msg
+} {1 {can't make ".icon" a transient: it is an icon for .top}}
+
+test wm-transient-1.6 {usage} {
+ deleteWindows
+ toplevel .icon -bg blue
+ toplevel .top
+ wm iconwindow .top .icon
+ toplevel .dummy
+ list [catch {wm transient .dummy .icon} msg] $msg
+} {1 {can't make ".icon" a master: it is an icon for .top}}
+
+
# FIXME:
# Test delivery of virtual events to the WM. We could check to see
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 5fbd83b..e9caba6 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.16 2002/05/23 19:55:18 mdejong Exp $
+ * RCS: @(#) $Id: tkUnixWm.c,v 1.17 2002/05/24 09:50:11 mdejong Exp $
*/
#include "tkPort.h"
@@ -2049,10 +2049,28 @@ Tk_WmCmd(clientData, interp, argc, argv)
master = Tk_Parent(master);
}
Tk_MakeWindowExist(master);
+
+ if (wmPtr->iconFor != NULL) {
+ Tcl_AppendResult(interp, "can't make \"", argv[2],
+ "\" a transient: it is an icon for ",
+ Tk_PathName(wmPtr->iconFor),
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+
wmPtr2 = ((TkWindow *) master)->wmInfoPtr;
if (wmPtr2->wrapperPtr == NULL) {
CreateWrapper(wmPtr2);
}
+
+ if (wmPtr2->iconFor != NULL) {
+ Tcl_AppendResult(interp, "can't make \"", argv[3],
+ "\" a master: it is an icon for ",
+ Tk_PathName(wmPtr2->iconFor),
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+
wmPtr->master = Tk_WindowId(wmPtr2->wrapperPtr);
if (wmPtr->masterWindowName != NULL) {
ckfree((char *) wmPtr->masterWindowName);
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 588ac71..046a931 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.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: tkWinWm.c,v 1.36 2002/05/23 19:55:19 mdejong Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.37 2002/05/24 09:50:11 mdejong Exp $
*/
#include "tkWinInt.h"
@@ -3261,6 +3261,7 @@ Tk_WmCmd(clientData, interp, argc, argv)
} else if ((c == 't') && (strncmp(argv[1], "transient", length) == 0)
&& (length >= 3)) {
TkWindow *masterPtr = wmPtr->masterPtr;
+ WmInfo *wmPtr2;
if ((argc != 3) && (argc != 4)) {
Tcl_AppendResult(interp, "wrong # arguments: must be \"",
@@ -3302,6 +3303,25 @@ Tk_WmCmd(clientData, interp, argc, argv)
while (!(masterPtr->flags & TK_TOP_LEVEL)) {
masterPtr = masterPtr->parentPtr;
}
+
+ if (wmPtr->iconFor != NULL) {
+ Tcl_AppendResult(interp, "can't make \"", argv[2],
+ "\" a transient: it is an icon for ",
+ Tk_PathName(wmPtr->iconFor),
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ wmPtr2 = masterPtr->wmInfoPtr;
+
+ if (wmPtr2->iconFor != NULL) {
+ Tcl_AppendResult(interp, "can't make \"", argv[3],
+ "\" a master: it is an icon for ",
+ Tk_PathName(wmPtr2->iconFor),
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+
wmPtr->masterPtr = masterPtr;
masterPtr->wmInfoPtr->numTransients++;