summaryrefslogtreecommitdiffstats
path: root/win/tkWinWm.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-06-22 10:13:26 (GMT)
committerhobbs <hobbs>2002-06-22 10:13:26 (GMT)
commitada9b40cb1ed12dff8ae71d167aeeea17bcade14 (patch)
tree960b07c03b8b74ffa66c1e547aa2338cdb07ea74 /win/tkWinWm.c
parent3016d7bb9fdd6c9886c4e501d5e7a1ac0823e9aa (diff)
downloadtk-ada9b40cb1ed12dff8ae71d167aeeea17bcade14.zip
tk-ada9b40cb1ed12dff8ae71d167aeeea17bcade14.tar.gz
tk-ada9b40cb1ed12dff8ae71d167aeeea17bcade14.tar.bz2
* doc/wm.n: TIP #95 Windows implementation and
* mac/tkMacWm.c (Tk_WmCmd): docs with mac and unix stubs. * unix/tkUnixWm.c (Tk_WmCmd): * win/tkWinWm.c (Tk_WmCmd): * tests/unixWm.test: * tests/winWm.test: more wm attr tests will be needed.
Diffstat (limited to 'win/tkWinWm.c')
-rw-r--r--win/tkWinWm.c100
1 files changed, 49 insertions, 51 deletions
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 583059f..5532c6e 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.42 2002/06/22 01:43:47 mdejong Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.43 2002/06/22 10:13:26 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -2146,7 +2146,50 @@ Tk_WmCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
wmPtr = winPtr->wmInfoPtr;
- if ((c == 'a') && (strncmp(argv[1], "attributes", length) == 0)
+ if ((c == 'a') && (strncmp(argv[1], "aspect", length) == 0)
+ && (length >= 2)) {
+ int numer1, denom1, numer2, denom2;
+
+ if ((argc != 3) && (argc != 7)) {
+ Tcl_AppendResult(interp, "wrong # arguments: must be \"",
+ argv[0], " aspect window ?minNumer minDenom ",
+ "maxNumer maxDenom?\"", (char *) NULL);
+ return TCL_ERROR;
+ }
+ if (argc == 3) {
+ if (wmPtr->sizeHintsFlags & PAspect) {
+ char buf[TCL_INTEGER_SPACE * 4];
+
+ sprintf(buf, "%d %d %d %d", wmPtr->minAspect.x,
+ wmPtr->minAspect.y, wmPtr->maxAspect.x,
+ wmPtr->maxAspect.y);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ }
+ return TCL_OK;
+ }
+ if (*argv[3] == '\0') {
+ wmPtr->sizeHintsFlags &= ~PAspect;
+ } else {
+ if ((Tcl_GetInt(interp, argv[3], &numer1) != TCL_OK)
+ || (Tcl_GetInt(interp, argv[4], &denom1) != TCL_OK)
+ || (Tcl_GetInt(interp, argv[5], &numer2) != TCL_OK)
+ || (Tcl_GetInt(interp, argv[6], &denom2) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+ if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) ||
+ (denom2 <= 0)) {
+ Tcl_SetResult(interp, "aspect number can't be <= 0",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+ wmPtr->minAspect.x = numer1;
+ wmPtr->minAspect.y = denom1;
+ wmPtr->maxAspect.x = numer2;
+ wmPtr->maxAspect.y = denom2;
+ wmPtr->sizeHintsFlags |= PAspect;
+ }
+ goto updateGeom;
+ } else if ((c == 'a') && (strncmp(argv[1], "attributes", length) == 0)
&& (length >= 2)) {
LONG style, exStyle, styleBit, *stylePtr;
char buf[TCL_INTEGER_SPACE];
@@ -2158,8 +2201,8 @@ Tk_WmCmd(clientData, interp, argc, argv)
argv[0], " attributes window",
" ?-disabled ?bool??",
" ?-toolwindow ?bool??",
- " ?-topmost ?bool??\"",
- (char *) NULL);
+ " ?-topmost ?bool??",
+ "\"", (char *) NULL);
return TCL_ERROR;
}
exStyle = wmPtr->exStyleConfig;
@@ -2193,8 +2236,7 @@ Tk_WmCmd(clientData, interp, argc, argv)
&& (length >= 3)) {
stylePtr = &exStyle;
styleBit = WS_EX_TOPMOST;
- if ((i < argc-1) &&
- (winPtr->flags & TK_EMBEDDED)) {
+ if ((i < argc-1) && (winPtr->flags & TK_EMBEDDED)) {
Tcl_AppendResult(interp, "can't set topmost flag on ",
winPtr->pathName, ": it is an embedded window",
(char *) NULL);
@@ -2218,50 +2260,6 @@ Tk_WmCmd(clientData, interp, argc, argv)
wmPtr->exStyleConfig = exStyle;
UpdateWrapper(winPtr);
}
- return TCL_OK;
- } else if ((c == 'a') && (strncmp(argv[1], "aspect", length) == 0)
- && (length >= 2)) {
- int numer1, denom1, numer2, denom2;
-
- if ((argc != 3) && (argc != 7)) {
- Tcl_AppendResult(interp, "wrong # arguments: must be \"",
- argv[0], " aspect window ?minNumer minDenom ",
- "maxNumer maxDenom?\"", (char *) NULL);
- return TCL_ERROR;
- }
- if (argc == 3) {
- if (wmPtr->sizeHintsFlags & PAspect) {
- char buf[TCL_INTEGER_SPACE * 4];
-
- sprintf(buf, "%d %d %d %d", wmPtr->minAspect.x,
- wmPtr->minAspect.y, wmPtr->maxAspect.x,
- wmPtr->maxAspect.y);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- }
- return TCL_OK;
- }
- if (*argv[3] == '\0') {
- wmPtr->sizeHintsFlags &= ~PAspect;
- } else {
- if ((Tcl_GetInt(interp, argv[3], &numer1) != TCL_OK)
- || (Tcl_GetInt(interp, argv[4], &denom1) != TCL_OK)
- || (Tcl_GetInt(interp, argv[5], &numer2) != TCL_OK)
- || (Tcl_GetInt(interp, argv[6], &denom2) != TCL_OK)) {
- return TCL_ERROR;
- }
- if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) ||
- (denom2 <= 0)) {
- Tcl_SetResult(interp, "aspect number can't be <= 0",
- TCL_STATIC);
- return TCL_ERROR;
- }
- wmPtr->minAspect.x = numer1;
- wmPtr->minAspect.y = denom1;
- wmPtr->maxAspect.x = numer2;
- wmPtr->maxAspect.y = denom2;
- wmPtr->sizeHintsFlags |= PAspect;
- }
- goto updateGeom;
} else if ((c == 'c') && (strncmp(argv[1], "client", length) == 0)
&& (length >= 2)) {
if ((argc != 3) && (argc != 4)) {
@@ -3484,7 +3482,7 @@ Tk_WmCmd(clientData, interp, argc, argv)
TkpWmSetState(winPtr, WithdrawnState);
} else {
Tcl_AppendResult(interp, "unknown or ambiguous option \"", argv[1],
- "\": must be aspect, client, command, deiconify, ",
+ "\": must be aspect, attributes, client, command, deiconify, ",
"focusmodel, frame, geometry, grid, group, iconbitmap, ",
"iconify, iconmask, iconname, iconposition, ",
"iconwindow, maxsize, minsize, overrideredirect, ",