summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-09-21 22:13:52 (GMT)
committerhobbs <hobbs>2001-09-21 22:13:52 (GMT)
commit38f3f6ea63f51c5d80a215f5bf71fd23ac5117f2 (patch)
tree286daa1a28863e65077549060579b5e6ad2a40bd /win
parent2ca21e11c3a446f76d05ebfb5838888412dc8b9b (diff)
downloadtk-38f3f6ea63f51c5d80a215f5bf71fd23ac5117f2.zip
tk-38f3f6ea63f51c5d80a215f5bf71fd23ac5117f2.tar.gz
tk-38f3f6ea63f51c5d80a215f5bf71fd23ac5117f2.tar.bz2
* win/tkWinWindow.c (TkpPrintWindowId, TkpScanWindowId): fixed to
work on Win64 with 64bit XIDs.
Diffstat (limited to 'win')
-rw-r--r--win/tkWinWindow.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c
index e2fa95b..b1484c7 100644
--- a/win/tkWinWindow.c
+++ b/win/tkWinWindow.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinWindow.c,v 1.6 2000/07/06 03:17:45 mo Exp $
+ * RCS: @(#) $Id: tkWinWindow.c,v 1.7 2001/09/21 22:13:52 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -173,7 +173,11 @@ TkpPrintWindowId(buf, window)
Window window; /* Window to be printed into buffer. */
{
HWND hwnd = (window) ? Tk_GetHWND(window) : 0;
- sprintf(buf, "0x%x", (unsigned int) hwnd);
+ /*
+ * Use pointer representation, because Win64 is P64 (*not* LP64).
+ * Windows doesn't print the 0x for %p, so we do it.
+ */
+ sprintf(buf, "0x%p", hwnd);
}
/*
@@ -203,14 +207,23 @@ TkpScanWindowId(interp, string, idPtr)
Tcl_Interp *interp; /* Interpreter to use for error reporting. */
char *string; /* String containing a (possibly signed)
* integer in a form acceptable to strtol. */
- int *idPtr; /* Place to store converted result. */
+ Window *idPtr; /* Place to store converted result. */
{
- int number;
Tk_Window tkwin;
+ Window number;
- if (Tcl_GetInt(interp, string, &number) != TCL_OK) {
+ /*
+ * We want sscanf for the 64-bit check, but if that doesn't work,
+ * then Tcl_GetInt manages the error correctly.
+ */
+ if (
+#ifdef _WIN64
+ (sscanf(string, "0x%p", &number) != 1) &&
+#endif
+ Tcl_GetInt(interp, string, (int *)&number) != TCL_OK) {
return TCL_ERROR;
}
+
tkwin = Tk_HWNDToWindow((HWND)number);
if (tkwin) {
*idPtr = Tk_WindowId(tkwin);