summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2006-08-17 01:07:11 (GMT)
committerhobbs <hobbs>2006-08-17 01:07:11 (GMT)
commit5ee6ad27caa9604bea6497f069083d463a106d80 (patch)
treedaae35abeb0120a42a5ecb6b962ac1c1e6d32ffa
parent4b65d8f23ccb54e81ff95fbab4cf72cac125145f (diff)
downloadtk-5ee6ad27caa9604bea6497f069083d463a106d80.zip
tk-5ee6ad27caa9604bea6497f069083d463a106d80.tar.gz
tk-5ee6ad27caa9604bea6497f069083d463a106d80.tar.bz2
* macosx/tkMacOSXWm.c (WmAttributesCmd): correct OS X result for
[wm attributes $top].
-rw-r--r--ChangeLog5
-rw-r--r--macosx/tkMacOSXWm.c89
2 files changed, 49 insertions, 45 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e3e6a0..4197492 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-08-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXWm.c (WmAttributesCmd): correct OS X result for
+ [wm attributes $top].
+
2006-07-25 Daniel Steffen <das@users.sourceforge.net>
* macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): handle key
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 95013c2..6a6bf38 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -13,7 +13,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.29 2006/07/24 04:45:59 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.7.2.30 2006/08/17 01:07:11 hobbs Exp $
*/
#include "tkMacOSXInt.h"
@@ -96,11 +96,9 @@ static int WmAspectCmd _ANSI_ARGS_((Tk_Window tkwin,
static int WmAttributesCmd _ANSI_ARGS_((Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
Tcl_Obj *CONST objv[]));
-static void WmAttrGetModifiedStatus(WindowRef macWindow, Tcl_Obj
- *result);
-static void WmAttrGetTitlePath(WindowRef macWindow, Tcl_Obj
- *result);
-static void WmAttrGetAlpha(WindowRef macWindow, Tcl_Obj *result);
+static Tcl_Obj * WmAttrGetModifiedStatus(WindowRef macWindow);
+static Tcl_Obj * WmAttrGetTitlePath(WindowRef macWindow);
+static Tcl_Obj * WmAttrGetAlpha(WindowRef macWindow);
static int WmClientCmd _ANSI_ARGS_((Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
Tcl_Obj *CONST objv[]));
@@ -777,7 +775,7 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
int i;
int index;
WindowRef macWindow;
- Tcl_Obj *result = NULL;
+ Tcl_Obj *objPtr = NULL;
const char *optionTable[] = {
"-alpha",
"-modified",
@@ -806,14 +804,18 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
macWindow = GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window));
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_SetObjResult(interp, result);
+ objPtr = Tcl_NewObj();
+ Tcl_ListObjAppendElement(NULL, objPtr,
+ Tcl_NewStringObj("-alpha", -1));
+ Tcl_ListObjAppendElement(NULL, objPtr, WmAttrGetAlpha(macWindow));
+ Tcl_ListObjAppendElement(NULL, objPtr,
+ Tcl_NewStringObj("-modified", -1));
+ Tcl_ListObjAppendElement(NULL, objPtr,
+ WmAttrGetModifiedStatus(macWindow));
+ Tcl_ListObjAppendElement(NULL, objPtr,
+ Tcl_NewStringObj("-titlepath", -1));
+ Tcl_ListObjAppendElement(NULL, objPtr, WmAttrGetTitlePath(macWindow));
+ Tcl_SetObjResult(interp, objPtr);
return TCL_OK;
}
if (objc == 4) {
@@ -821,19 +823,18 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
&index) != TCL_OK) {
return TCL_ERROR;
}
- result = Tcl_NewObj();
switch (index) {
case WmAttrModifiedIdx:
- WmAttrGetModifiedStatus(macWindow, result);
+ objPtr = WmAttrGetModifiedStatus(macWindow);
break;
case WmAttrTitlePathIdx:
- WmAttrGetTitlePath(macWindow, result);
+ objPtr = WmAttrGetTitlePath(macWindow);
break;
case WmAttrAlphaIdx:
- WmAttrGetAlpha(macWindow, result);
+ objPtr = WmAttrGetAlpha(macWindow);
break;
}
- Tcl_SetObjResult(interp, result);
+ Tcl_SetObjResult(interp, objPtr);
return TCL_OK;
}
@@ -858,7 +859,7 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
TCL_OK) {
return TCL_ERROR;
}
- result = objv[i+1];
+ objPtr = objv[i+1];
SetWindowModified(macWindow, boolean);
break;
case WmAttrTitlePathIdx:
@@ -897,7 +898,7 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
-1));
return TCL_ERROR;
} else {
- result = objv[i+1];
+ objPtr = objv[i+1];
}
break;
case WmAttrAlphaIdx:
@@ -913,12 +914,12 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
} else if (dval > 1.0) {
dval = 1.0;
}
- result = Tcl_NewDoubleObj(dval);
+ objPtr = Tcl_NewDoubleObj(dval);
SetWindowAlpha(macWindow, dval);
break;
}
}
- Tcl_SetObjResult(interp, result);
+ Tcl_SetObjResult(interp, objPtr);
return TCL_OK;
}
@@ -930,18 +931,17 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
* attributes command.
*
* Results:
- * Nothing.
- *
+ * Returns value in unrefcounted Tcl_Obj.
+ *
* Side effects:
- * Appends the modified status of the given window to the Tcl_Obj
- * passed in.
+ * None.
*
*----------------------------------------------------------------------
*/
-static void WmAttrGetModifiedStatus(WindowRef macWindow, Tcl_Obj *result)
+static Tcl_Obj *
+WmAttrGetModifiedStatus(WindowRef macWindow)
{
- Tcl_AppendObjToObj(result, Tcl_NewBooleanObj(
- (IsWindowModified(macWindow) == true)));
+ return Tcl_NewBooleanObj((IsWindowModified(macWindow) == true));
}
/*
@@ -952,15 +952,15 @@ static void WmAttrGetModifiedStatus(WindowRef macWindow, Tcl_Obj *result)
* attributes command.
*
* Results:
- * Nothing.
- *
+ * Returns value in unrefcounted Tcl_Obj.
+ *
* Side effects:
- * Appends the proxy file path of the given window to the Tcl_Obj
- * passed in.
+ * None.
*
*----------------------------------------------------------------------
*/
-static void WmAttrGetTitlePath(WindowRef macWindow, Tcl_Obj *result)
+static Tcl_Obj *
+WmAttrGetTitlePath(WindowRef macWindow)
{
FSRef ref;
AliasHandle alias;
@@ -976,9 +976,9 @@ static void WmAttrGetTitlePath(WindowRef macWindow, Tcl_Obj *result)
err = FSRefMakePath(&ref, path, 2048);
}
if (err == noErr) {
- Tcl_AppendToObj(result, (char*) path, -1);
+ return Tcl_NewStringObj((char*) path, -1);
} else {
- Tcl_AppendToObj(result, "{}", -1);
+ return Tcl_NewStringObj("", 0);
}
}
@@ -990,22 +990,21 @@ static void WmAttrGetTitlePath(WindowRef macWindow, Tcl_Obj *result)
* attributes command.
*
* Results:
- * Nothing.
- *
+ * Returns value in unrefcounted Tcl_Obj.
+ *
* Side effects:
- * Appends the alpha value of the given window to the Tcl_Obj
- * passed in.
+ * None.
*
*----------------------------------------------------------------------
*/
-static void
-WmAttrGetAlpha(WindowRef macWindow, Tcl_Obj *result)
+static Tcl_Obj *
+WmAttrGetAlpha(WindowRef macWindow)
{
float fval;
if (GetWindowAlpha(macWindow, &fval) != noErr) {
fval = 1.0;
}
- Tcl_AppendObjToObj(result, Tcl_NewDoubleObj(fval));
+ return Tcl_NewDoubleObj(fval);
}
/*