summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordgp@users.sourceforge.net <dgp>2015-01-02 20:50:55 (GMT)
committerdgp@users.sourceforge.net <dgp>2015-01-02 20:50:55 (GMT)
commit67a3f845a3525ca40e758873d5e585ff75359af6 (patch)
tree1b4e75fb2e1a4679e9fdbc7981100611810b1ba6 /macosx
parentbee9091cca304d5a8a79ce7db7fe6fc1b7390cc7 (diff)
parent4aa1ddaabab9264d55de8fa4523ced7bc55ebc5a (diff)
downloadtk-67a3f845a3525ca40e758873d5e585ff75359af6.zip
tk-67a3f845a3525ca40e758873d5e585ff75359af6.tar.gz
tk-67a3f845a3525ca40e758873d5e585ff75359af6.tar.bz2
Merge 8.5. Fix [winfo id] for Cocoa.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXEmbed.c48
-rw-r--r--macosx/tkMacOSXPort.h10
2 files changed, 47 insertions, 11 deletions
diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c
index 1d66b82..5cd1e41 100644
--- a/macosx/tkMacOSXEmbed.c
+++ b/macosx/tkMacOSXEmbed.c
@@ -174,6 +174,50 @@ TkpMakeWindow(
/*
*----------------------------------------------------------------------
*
+ * TkpScanWindowId --
+ *
+ * Given a string, produce the corresponding Window Id.
+ *
+ * Results:
+ * The return value is normally TCL_OK; in this case *idPtr will be set
+ * to the Window value equivalent to string. If string is improperly
+ * formed then TCL_ERROR is returned and an error message will be left in
+ * the interp's result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpScanWindowId(
+ Tcl_Interp *interp,
+ CONST char * string,
+ Window *idPtr)
+{
+ int code;
+ Tcl_Obj obj;
+
+ obj.refCount = 1;
+ obj.bytes = string;
+ obj.length = strlen(string);
+ obj.typePtr = NULL;
+
+ code = Tcl_GetLongFromObj(interp, &obj, (long *)idPtr);
+
+ if (obj.refCount > 1) {
+ Tcl_Panic("invalid sharing of Tcl_Obj on C stack");
+ }
+ if (obj.typePtr && obj.typePtr->freeIntRepProc) {
+ obj.typePtr->freeIntRepProc(&obj);
+ }
+ return code;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkpUseWindow --
*
* This procedure causes a Tk window to use a given X window as its
@@ -215,7 +259,7 @@ TkpUseWindow(
}
/*
- * Decode the container pointer, and look for it among the list of
+ * Decode the container window ID, and look for it among the list of
* available containers.
*
* N.B. For now, we are limiting the containers to be in the same Tk
@@ -223,7 +267,7 @@ TkpUseWindow(
* containers.
*/
- if (Tcl_GetInt(interp, string, (int*) &parent) != TCL_OK) {
+ if (TkpScanWindowId(interp, string, (Window *)&parent) != TCL_OK) {
return TCL_ERROR;
}
diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h
index 1576ec7..0c3b347 100644
--- a/macosx/tkMacOSXPort.h
+++ b/macosx/tkMacOSXPort.h
@@ -141,18 +141,10 @@
/*
* This macro stores a representation of the window handle in a string.
- * This should perhaps use the real size of an XID.
*/
#define TkpPrintWindowId(buf,w) \
- sprintf((buf), "0x%x", (unsigned int) (w))
-
-/*
- * TkpScanWindowId is just an alias for Tcl_GetInt on Unix.
- */
-
-#define TkpScanWindowId(i,s,wp) \
- Tcl_GetInt((i),(s),(int *) (wp))
+ sprintf((buf), "0x%lx", (unsigned long) (w))
/*
* Turn off Tk double-buffering as Aqua windows are already double-buffered.