Attachment "tk-wm-grid-div0.patch" to
ticket [742882ff]
added by
jenglish
2004-06-17 02:51:09.
Date: Wed Jun 16 12:50:20 PDT 2004
Files: unix/tkUnixWm.c win/tkWinWm.c macosx/tkMacOSXWm.c tests/unixWm.test tests/wm.test
Bugid: #742882
--- unix/tkUnixWm.c.wm-grid-div0.old 2004-06-04 13:01:35.000000000 -0700
+++ unix/tkUnixWm.c 2004-06-16 12:40:42.000000000 -0700
@@ -1729,12 +1729,12 @@
Tcl_SetResult(interp, "baseHeight can't be < 0", TCL_STATIC);
return TCL_ERROR;
}
- if (widthInc < 0) {
- Tcl_SetResult(interp, "widthInc can't be < 0", TCL_STATIC);
+ if (widthInc <= 0) {
+ Tcl_SetResult(interp, "widthInc can't be <= 0", TCL_STATIC);
return TCL_ERROR;
}
- if (heightInc < 0) {
- Tcl_SetResult(interp, "heightInc can't be < 0", TCL_STATIC);
+ if (heightInc <= 0) {
+ Tcl_SetResult(interp, "heightInc can't be <= 0", TCL_STATIC);
return TCL_ERROR;
}
Tk_SetGrid((Tk_Window) winPtr, reqWidth, reqHeight, widthInc,
@@ -3225,6 +3225,16 @@
register WmInfo *wmPtr;
/*
+ * Ensure widthInc and heightInc are greater than 0
+ */
+ if (widthInc <= 0) {
+ widthInc = 1;
+ }
+ if (heightInc <= 0) {
+ heightInc = 1;
+ }
+
+ /*
* Find the top-level window for tkwin, plus the window manager
* information.
*/
--- win/tkWinWm.c.wm-grid-div0.old 2004-06-15 15:57:02.000000000 -0700
+++ win/tkWinWm.c 2004-06-16 12:41:05.000000000 -0700
@@ -3276,12 +3276,12 @@
Tcl_SetResult(interp, "baseHeight can't be < 0", TCL_STATIC);
return TCL_ERROR;
}
- if (widthInc < 0) {
- Tcl_SetResult(interp, "widthInc can't be < 0", TCL_STATIC);
+ if (widthInc <= 0) {
+ Tcl_SetResult(interp, "widthInc can't be <= 0", TCL_STATIC);
return TCL_ERROR;
}
- if (heightInc < 0) {
- Tcl_SetResult(interp, "heightInc can't be < 0", TCL_STATIC);
+ if (heightInc <= 0) {
+ Tcl_SetResult(interp, "heightInc can't be <= 0", TCL_STATIC);
return TCL_ERROR;
}
Tk_SetGrid((Tk_Window) winPtr, reqWidth, reqHeight, widthInc,
@@ -4787,6 +4787,17 @@
register WmInfo *wmPtr;
/*
+ * Ensure widthInc and heightInc are greater than 0
+ */
+ if (widthInc <= 0) {
+ widthInc = 1;
+ }
+ if (heightInc <= 0) {
+ heightInc = 1;
+ }
+
+
+ /*
* Find the top-level window for tkwin, plus the window manager
* information.
*/
--- macosx/tkMacOSXWm.c.wm-grid-div0.old 2004-02-16 15:56:42.000000000 -0800
+++ macosx/tkMacOSXWm.c 2004-06-16 12:41:21.000000000 -0700
@@ -1318,12 +1318,12 @@
Tcl_SetResult(interp, "baseHeight can't be < 0", TCL_STATIC);
return TCL_ERROR;
}
- if (widthInc < 0) {
- Tcl_SetResult(interp, "widthInc can't be < 0", TCL_STATIC);
+ if (widthInc <= 0) {
+ Tcl_SetResult(interp, "widthInc can't be <= 0", TCL_STATIC);
return TCL_ERROR;
}
- if (heightInc < 0) {
- Tcl_SetResult(interp, "heightInc can't be < 0", TCL_STATIC);
+ if (heightInc <= 0) {
+ Tcl_SetResult(interp, "heightInc can't be <= 0", TCL_STATIC);
return TCL_ERROR;
}
Tk_SetGrid((Tk_Window) winPtr, reqWidth, reqHeight, widthInc,
@@ -2658,6 +2658,17 @@
WmInfo *wmPtr;
/*
+ * Ensure widthInc and heightInc are greater than 0
+ */
+ if (widthInc <= 0) {
+ widthInc = 1;
+ }
+ if (heightInc <= 0) {
+ heightInc = 1;
+ }
+
+
+ /*
* Find the top-level window for tkwin, plus the window manager
* information.
*/
@@ -2710,7 +2721,7 @@
wmPtr->sizeHintsFlags |= PBaseSize|PResizeInc;
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tk_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
--- tests/unixWm.test.wm-grid-div0.old 2003-11-17 17:47:51.000000000 -0800
+++ tests/unixWm.test 2004-06-16 12:46:10.000000000 -0700
@@ -728,13 +728,13 @@
} {1 {expected integer but got "bar"}}
test unixWm-20.9 {Tk_WmCmd procedure, "grid" option} unix {
list [catch {wm grid .t 10 11 -2 13} msg] $msg
-} {1 {widthInc can't be < 0}}
+} {1 {widthInc can't be <= 0}}
test unixWm-20.10 {Tk_WmCmd procedure, "grid" option} unix {
list [catch {wm grid .t 10 11 12 bogus} msg] $msg
} {1 {expected integer but got "bogus"}}
test unixWm-20.11 {Tk_WmCmd procedure, "grid" option} unix {
list [catch {wm grid .t 10 11 12 -1} msg] $msg
-} {1 {heightInc can't be < 0}}
+} {1 {heightInc can't be <= 0}}
catch {destroy .t}
catch {destroy .icon}
--- tests/wm.test.wm-grid-div0.old 2004-06-16 12:46:59.000000000 -0700
+++ tests/wm.test 2004-06-16 12:47:14.000000000 -0700
@@ -393,11 +393,11 @@
test wm-grid-1.11 {usage} {
list [catch {wm grid . 13 14 -1 16} msg] $msg
-} {1 {widthInc can't be < 0}}
+} {1 {widthInc can't be <= 0}}
test wm-grid-1.12 {usage} {
list [catch {wm grid . 13 14 15 -1} msg] $msg
-} {1 {heightInc can't be < 0}}
+} {1 {heightInc can't be <= 0}}
test wm-grid-2.1 {setting and reading values} {
set result {}