diff options
author | das <das> | 2006-04-22 04:12:25 (GMT) |
---|---|---|
committer | das <das> | 2006-04-22 04:12:25 (GMT) |
commit | e7fff36dc776fecfb7be046b43127dd1a39a706d (patch) | |
tree | 12982ca17e3d41a2c531e36d8990a41c9a2b47fa | |
parent | 8e44ba5e40675ecc586f9062741890846a788e77 (diff) | |
download | tk-e7fff36dc776fecfb7be046b43127dd1a39a706d.zip tk-e7fff36dc776fecfb7be046b43127dd1a39a706d.tar.gz tk-e7fff36dc776fecfb7be046b43127dd1a39a706d.tar.bz2 |
* macosx/tkMacOSXEmbed.c:
* macosx/tkMacOSXWm.c:
* tests/constraints.tcl:
* tests/wm.test: sync with 2006-04-18 commit to HEAD. (darley)
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | macosx/tkMacOSXEmbed.c | 23 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 68 | ||||
-rw-r--r-- | tests/constraints.tcl | 1 | ||||
-rw-r--r-- | tests/wm.test | 7 |
5 files changed, 92 insertions, 14 deletions
@@ -1,3 +1,10 @@ +2006-04-22 Daniel Steffen <das@users.sourceforge.net> + + * macosx/tkMacOSXEmbed.c: + * macosx/tkMacOSXWm.c: + * tests/constraints.tcl: + * tests/wm.test: sync with 2006-04-18 commit to HEAD. (darley) + 2006-04-12 Don Porter <dgp@users.sourceforge.net> *** 8.4.13 TAGGED FOR RELEASE *** diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c index b759ffa..802a15c 100644 --- a/macosx/tkMacOSXEmbed.c +++ b/macosx/tkMacOSXEmbed.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXEmbed.c,v 1.2.2.2 2006/03/28 02:44:13 das Exp $ + * RCS: @(#) $Id: tkMacOSXEmbed.c,v 1.2.2.3 2006/04/22 04:12:25 das Exp $ */ #include "tkMacOSXInt.h" @@ -229,10 +229,10 @@ TkpUseWindow( * for tkwin; must be an integer value. */ { TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *usePtr; MacDrawable *parent, *macWin; Container *containerPtr; XEvent event; - int result; if (winPtr->window != None) { Tcl_AppendResult(interp, "can't modify container after widget is created", (char *) NULL); @@ -249,11 +249,23 @@ TkpUseWindow( * */ - if (Tcl_GetInt(interp, string, &result) != TCL_OK) { + if (Tcl_GetInt(interp, string, (int*) &parent) != TCL_OK) { return TCL_ERROR; } - parent = (MacDrawable *) result; + usePtr = (TkWindow *) Tk_IdToWindow(winPtr->display, (Window) parent); + if (usePtr != NULL) { + if (!(usePtr->flags & TK_CONTAINER)) { + Tcl_AppendResult(interp, "window \"", usePtr->pathName, + "\" doesn't have -container option set", NULL); + return TCL_ERROR; + } + } + + /* + * The code below can probably be simplified given we have already + * discovered 'usePtr' above. + */ /* * Save information about the container and the embedded window @@ -325,7 +337,8 @@ TkpUseWindow( */ if (gMacEmbedHandler == NULL || - gMacEmbedHandler->registerWinProc(result, (Tk_Window) winPtr) != TCL_OK) { + gMacEmbedHandler->registerWinProc((int) parent, + (Tk_Window) winPtr) != TCL_OK) { Tcl_AppendResult(interp, "The window ID ", string, " does not correspond to a valid Tk Window.", (char *) NULL); diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 7c7818b..19376f3 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.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: tkMacOSXWm.c,v 1.7.2.23 2006/04/11 07:36:40 das Exp $ + * RCS: @(#) $Id: tkMacOSXWm.c,v 1.7.2.24 2006/04/22 04:12:25 das Exp $ */ #include "tkMacOSXInt.h" @@ -773,15 +773,15 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */ WindowRef macWindow; Tcl_Obj *result = NULL; const char *optionTable[] = { + "-alpha", "-modified", "-titlepath", - "-alpha", (char *)NULL }; enum optionIdx { + WmAttrAlphaIdx, WmAttrModifiedIdx, WmAttrTitlePathIdx, - WmAttrAlphaIdx, }; /* Must have objc >= 3 at this point. */ @@ -801,17 +801,17 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */ if (objc == 3) { result = Tcl_NewObj(); + Tcl_AppendToObj(result, " -alpha ", -1); + WmAttrGetAlpha(macWindow, result); Tcl_AppendToObj(result, "-modified ", -1); WmAttrGetModifiedStatus(macWindow, result); Tcl_AppendToObj(result, " -titlepath ", -1); WmAttrGetTitlePath(macWindow, result); - Tcl_AppendToObj(result, " -alpha ", -1); - WmAttrGetAlpha(macWindow, result); Tcl_SetObjResult(interp, result); return TCL_OK; } if (objc == 4) { - if (Tcl_GetIndexFromObj(interp, objv[3], optionTable, "option", 0, + if (Tcl_GetIndexFromObj(interp, objv[3], optionTable, "attribute", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -842,7 +842,7 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */ OSErr err; double dval; - if (Tcl_GetIndexFromObj(interp, objv[i], optionTable, "option", 0, + if (Tcl_GetIndexFromObj(interp, objv[i], optionTable, "attribute", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -2849,6 +2849,12 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv) return TCL_ERROR; } + if ((TkWindow *) master == winPtr) { + Tcl_AppendResult(interp, "can't make \"", Tk_PathName(winPtr), + "\" its own master", NULL); + return TCL_ERROR; + } + argv3 = Tcl_GetStringFromObj(objv[3], &length); wmPtr->master = Tk_WindowId(master); wmPtr->masterWindowName = ckalloc((unsigned) length+1); @@ -3186,6 +3192,7 @@ UpdateGeometryInfo( TkWindow *winPtr = (TkWindow *) clientData; WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height; + int min, max; unsigned long serial; wmPtr->flags &= ~WM_UPDATE_PENDING; @@ -3212,6 +3219,30 @@ UpdateGeometryInfo( if (width <= 0) { width = 1; } + + /* + * Account for window max/min width + */ + + if (wmPtr->gridWin != NULL) { + min = winPtr->reqWidth + + (wmPtr->minWidth - wmPtr->reqGridWidth)*wmPtr->widthInc; + if (wmPtr->maxWidth > 0) { + max = winPtr->reqWidth + + (wmPtr->maxWidth - wmPtr->reqGridWidth)*wmPtr->widthInc; + } else { + max = 0; + } + } else { + min = wmPtr->minWidth; + max = wmPtr->maxWidth; + } + if (width < min) { + width = min; + } else if ((max > 0) && (width > max)) { + width = max; + } + if (wmPtr->height == -1) { height = winPtr->reqHeight; } else if (wmPtr->gridWin != NULL) { @@ -3225,6 +3256,29 @@ UpdateGeometryInfo( } /* + * Account for window max/min height + */ + + if (wmPtr->gridWin != NULL) { + min = winPtr->reqHeight + + (wmPtr->minHeight - wmPtr->reqGridHeight)*wmPtr->heightInc; + if (wmPtr->maxHeight > 0) { + max = winPtr->reqHeight + + (wmPtr->maxHeight-wmPtr->reqGridHeight)*wmPtr->heightInc; + } else { + max = 0; + } + } else { + min = wmPtr->minHeight; + max = wmPtr->maxHeight; + } + if (height < min) { + height = min; + } else if ((max > 0) && (height > max)) { + height = max; + } + + /* * Compute the new position for the upper-left pixel of the window's * decorative frame. This is tricky, because we need to include the * border widths supplied by a reparented parent in this calculation, diff --git a/tests/constraints.tcl b/tests/constraints.tcl index 7898250..f131ff8 100644 --- a/tests/constraints.tcl +++ b/tests/constraints.tcl @@ -128,6 +128,7 @@ namespace import -force tk::test::* namespace import -force tcltest::testConstraint testConstraint notAqua [expr {[tk windowingsystem] ne "aqua"}] +testConstraint aqua [expr {[tk windowingsystem] eq "aqua"}] testConstraint userInteraction 0 testConstraint nonUnixUserInteraction [expr {[testConstraint userInteraction] || [testConstraint unix]}] diff --git a/tests/wm.test b/tests/wm.test index e34d58d..4202720 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.21.2.6 2005/12/01 18:31:43 dgp Exp $ +# RCS: @(#) $Id: wm.test,v 1.21.2.7 2006/04/22 04:12:25 das Exp $ # This file tests window manager interactions that work across # platforms. Window manager tests that only work on a specific @@ -142,10 +142,13 @@ test wm-attributes-1.2.3 {usage} {pcOnly} { list [catch {wm attributes . -to} err] $err } {1 {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-disabled ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}} -test wm-attributes-1.2.4 {usage} {macOrUnix} { +test wm-attributes-1.2.4 {usage} {macOrUnix notAqua} { list [catch {wm attributes . _} err] $err } {1 {wrong # args: should be "wm attributes window"}} +test wm-attributes-1.2.5 {usage} {aqua} { + list [catch {wm attributes . _} err] $err +} {1 {bad attribute "_": must be -alpha, -modified, or -titlepath}} test wm-client-1.1 {usage} { list [catch {wm client} err] $err |