diff options
author | hobbs <hobbs@noemail.net> | 2001-09-21 22:13:51 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2001-09-21 22:13:51 (GMT) |
commit | b6805694144daa52f8be6751a5b6bcc148a678ec (patch) | |
tree | 286daa1a28863e65077549060579b5e6ad2a40bd /win/tkWinWindow.c | |
parent | b6f13a772832ee5fdd3c7a807d0370dca3cedaf6 (diff) | |
download | tk-b6805694144daa52f8be6751a5b6bcc148a678ec.zip tk-b6805694144daa52f8be6751a5b6bcc148a678ec.tar.gz tk-b6805694144daa52f8be6751a5b6bcc148a678ec.tar.bz2 |
* win/tkWinWindow.c (TkpPrintWindowId, TkpScanWindowId): fixed to
work on Win64 with 64bit XIDs.
FossilOrigin-Name: b995daa12bd4256afe26d65804ac4fbfac1c92c6
Diffstat (limited to 'win/tkWinWindow.c')
-rw-r--r-- | win/tkWinWindow.c | 23 |
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); |