diff options
author | hobbs <hobbs> | 2000-11-03 01:22:16 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2000-11-03 01:22:16 (GMT) |
commit | 788680db0e6198c631a5b63066a21e6749cad38b (patch) | |
tree | a0b9272393eee9e4aaf17c795e92a28278d20b8c | |
parent | bd04e28031219d0fe2d9b5040d17ba7f1220bca5 (diff) | |
download | tk-788680db0e6198c631a5b63066a21e6749cad38b.zip tk-788680db0e6198c631a5b63066a21e6749cad38b.tar.gz tk-788680db0e6198c631a5b63066a21e6749cad38b.tar.bz2 |
* win/tkWinButton.c:
* win/tkWinDialog.c:
* win/tkWinScrlbr.c:
* win/tkWinWm.c: fixed up code for Win64 support. This mostly
remains in _WIN64 #ifdef's, until updated compilers are standard.
-rw-r--r-- | win/tkWinButton.c | 11 | ||||
-rw-r--r-- | win/tkWinDialog.c | 63 | ||||
-rw-r--r-- | win/tkWinScrlbr.c | 15 | ||||
-rw-r--r-- | win/tkWinWm.c | 25 |
4 files changed, 104 insertions, 10 deletions
diff --git a/win/tkWinButton.c b/win/tkWinButton.c index aa35dd7..1aff26b 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.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: tkWinButton.c,v 1.10 2000/07/06 03:17:44 mo Exp $ + * RCS: @(#) $Id: tkWinButton.c,v 1.11 2000/11/03 01:22:16 hobbs Exp $ */ #define OEMRESOURCE @@ -271,8 +271,13 @@ CreateProc(tkwin, parentWin, instanceData) parent, NULL, Tk_GetHINSTANCE(), NULL); SetWindowPos(butPtr->hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); +#ifdef _WIN64 + butPtr->oldProc = (WNDPROC)SetWindowLongPtr(butPtr->hwnd, GWLP_WNDPROC, + (LONG_PTR) ButtonProc); +#else butPtr->oldProc = (WNDPROC)SetWindowLong(butPtr->hwnd, GWL_WNDPROC, (DWORD) ButtonProc); +#endif window = Tk_AttachHWND(tkwin, butPtr->hwnd); return window; @@ -301,7 +306,11 @@ TkpDestroyButton(butPtr) WinButton *winButPtr = (WinButton *)butPtr; HWND hwnd = winButPtr->hwnd; if (hwnd) { +#ifdef _WIN64 + SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) winButPtr->oldProc); +#else SetWindowLong(hwnd, GWL_WNDPROC, (DWORD) winButPtr->oldProc); +#endif } } diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 8bb1dea..928b41e 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.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: tkWinDialog.c,v 1.17 2000/11/02 02:19:57 ericm Exp $ + * RCS: @(#) $Id: tkWinDialog.c,v 1.18 2000/11/03 01:22:16 hobbs Exp $ * */ @@ -184,7 +184,7 @@ Tk_ChooseColorObjCmd(clientData, interp, objc, objv) HWND hWnd; int i, oldMode, winCode, result; CHOOSECOLOR chooseColor; - static inited = 0; + static int inited = 0; static COLORREF dwCustColors[16]; static long oldColor; /* the color selected last time */ static char *optionStrings[] = { @@ -219,7 +219,7 @@ Tk_ChooseColorObjCmd(clientData, interp, objc, objv) chooseColor.lpCustColors = dwCustColors; chooseColor.Flags = CC_RGBINIT | CC_FULLOPEN | CC_ENABLEHOOK; chooseColor.lCustData = (LPARAM) NULL; - chooseColor.lpfnHook = ColorDlgHookProc; + chooseColor.lpfnHook = (LPOFNHOOKPROC) ColorDlgHookProc; chooseColor.lpTemplateName = (LPTSTR) interp; for (i = 1; i < objc; i += 2) { @@ -603,8 +603,13 @@ GetFileNameW(clientData, interp, objc, objv, open) ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hWnd; +#ifdef _WIN64 + ofn.hInstance = (HINSTANCE) GetWindowLongPtr(ofn.hwndOwner, + GWLP_HINSTANCE); +#else ofn.hInstance = (HINSTANCE) GetWindowLong(ofn.hwndOwner, GWL_HINSTANCE); +#endif ofn.lpstrFilter = NULL; ofn.lpstrCustomFilter = NULL; ofn.nMaxCustFilter = 0; @@ -620,7 +625,7 @@ GetFileNameW(clientData, interp, objc, objv, open) ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lpstrDefExt = NULL; - ofn.lpfnHook = OFNHookProcW; + ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProcW; ofn.lCustData = (LPARAM) interp; ofn.lpTemplateName = NULL; @@ -877,7 +882,11 @@ OFNHookProcW( OPENFILENAMEW *ofnPtr; if (uMsg == WM_INITDIALOG) { +#ifdef _WIN64 + SetWindowLongPtr(hdlg, GWLP_USERDATA, lParam); +#else SetWindowLong(hdlg, GWL_USERDATA, lParam); +#endif } else if (uMsg == WM_WINDOWPOSCHANGED) { /* * This message is delivered at the right time to enable Tk @@ -886,12 +895,20 @@ OFNHookProcW( * WM_WINDOWPOSCHANGED message. */ +#ifdef _WIN64 + ofnPtr = (OPENFILENAMEW *) GetWindowLongPtr(hdlg, GWLP_USERDATA); +#else ofnPtr = (OPENFILENAMEW *) GetWindowLong(hdlg, GWL_USERDATA); +#endif if (ofnPtr != NULL) { hdlg = GetParent(hdlg); tsdPtr->debugInterp = (Tcl_Interp *) ofnPtr->lCustData; Tcl_DoWhenIdle(SetTkDialog, (ClientData) hdlg); +#ifdef _WIN64 + SetWindowLongPtr(hdlg, GWLP_USERDATA, (LPARAM) NULL); +#else SetWindowLong(hdlg, GWL_USERDATA, (LPARAM) NULL); +#endif } } return 0; @@ -1035,8 +1052,13 @@ GetFileNameA(clientData, interp, objc, objv, open) ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hWnd; +#ifdef _WIN64 + ofn.hInstance = (HINSTANCE) GetWindowLongPtr(ofn.hwndOwner, + GWLP_HINSTANCE); +#else ofn.hInstance = (HINSTANCE) GetWindowLong(ofn.hwndOwner, GWL_HINSTANCE); +#endif ofn.lpstrFilter = NULL; ofn.lpstrCustomFilter = NULL; ofn.nMaxCustFilter = 0; @@ -1052,7 +1074,7 @@ GetFileNameA(clientData, interp, objc, objv, open) ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lpstrDefExt = NULL; - ofn.lpfnHook = OFNHookProc; + ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProc; ofn.lCustData = (LPARAM) interp; ofn.lpTemplateName = NULL; @@ -1231,7 +1253,11 @@ OFNHookProc( OPENFILENAME *ofnPtr; if (uMsg == WM_INITDIALOG) { +#ifdef _WIN64 + SetWindowLongPtr(hdlg, GWLP_USERDATA, lParam); +#else SetWindowLong(hdlg, GWL_USERDATA, lParam); +#endif } else if (uMsg == WM_WINDOWPOSCHANGED) { /* * This message is delivered at the right time to both @@ -1241,14 +1267,22 @@ OFNHookProc( * WM_WINDOWPOSCHANGED message. */ +#ifdef _WIN64 + ofnPtr = (OPENFILENAME *) GetWindowLongPtr(hdlg, GWLP_USERDATA); +#else ofnPtr = (OPENFILENAME *) GetWindowLong(hdlg, GWL_USERDATA); +#endif if (ofnPtr != NULL) { if (ofnPtr->Flags & OFN_EXPLORER) { hdlg = GetParent(hdlg); } tsdPtr->debugInterp = (Tcl_Interp *) ofnPtr->lCustData; Tcl_DoWhenIdle(SetTkDialog, (ClientData) hdlg); +#ifdef _WIN64 + SetWindowLongPtr(hdlg, GWLP_USERDATA, (LPARAM) NULL); +#else SetWindowLong(hdlg, GWL_USERDATA, (LPARAM) NULL); +#endif } } return 0; @@ -1497,8 +1531,13 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv) ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hWnd; +#ifdef _WIN64 + ofn.hInstance = (HINSTANCE) GetWindowLongPtr(ofn.hwndOwner, + GWLP_HINSTANCE); +#else ofn.hInstance = (HINSTANCE) GetWindowLong(ofn.hwndOwner, GWL_HINSTANCE); +#endif ofn.lpstrFilter = NULL; ofn.lpstrCustomFilter = NULL; ofn.nMaxCustFilter = 0; @@ -1515,7 +1554,7 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv) ofn.nFileExtension = 0; ofn.lpstrDefExt = NULL; ofn.lCustData = (LPARAM) &cd; - ofn.lpfnHook = ChooseDirectoryHookProc; + ofn.lpfnHook = (LPOFNHOOKPROC) ChooseDirectoryHookProc; ofn.lpTemplateName = MAKEINTRESOURCE(FILEOPENORD); if (Tcl_DStringValue(&utfDirString)[0] != '\0') { @@ -1642,12 +1681,20 @@ ChooseDirectoryHookProc( * GWL_USERDATA keeps track of ofnPtr. */ +#ifdef _WIN64 + ofnPtr = (OPENFILENAME *) GetWindowLongPtr(hwnd, GWLP_USERDATA); +#else ofnPtr = (OPENFILENAME *) GetWindowLong(hwnd, GWL_USERDATA); +#endif if (message == WM_INITDIALOG) { ChooseDir *cdPtr; +#ifdef _WIN64 + SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); +#else SetWindowLong(hwnd, GWL_USERDATA, lParam); +#endif ofnPtr = (OPENFILENAME *) lParam; cdPtr = (ChooseDir *) ofnPtr->lCustData; cdPtr->lastCtrl = 0; @@ -1994,6 +2041,10 @@ SetTkDialog(ClientData clientData) hwnd = (HWND) clientData; +#ifdef _WIN64 + sprintf(buf, "0x%16x", hwnd); +#else sprintf(buf, "0x%08x", hwnd); +#endif Tcl_SetVar(tsdPtr->debugInterp, "tk_dialog", buf, TCL_GLOBAL_ONLY); } diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index a6bb09a..1a9cbc9 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.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: tkWinScrlbr.c,v 1.5 2000/03/31 09:24:27 hobbs Exp $ + * RCS: @(#) $Id: tkWinScrlbr.c,v 1.6 2000/11/03 01:22:17 hobbs Exp $ */ #include "tkWinInt.h" @@ -249,8 +249,13 @@ CreateProc(tkwin, parentWin, instanceData) } scrollPtr->lastVertical = scrollPtr->info.vertical; +#ifdef _WIN64 + scrollPtr->oldProc = (WNDPROC)SetWindowLongPtr(scrollPtr->hwnd, + GWLP_WNDPROC, (LONG_PTR) ScrollbarProc); +#else scrollPtr->oldProc = (WNDPROC)SetWindowLong(scrollPtr->hwnd, GWL_WNDPROC, (DWORD) ScrollbarProc); +#endif window = Tk_AttachHWND(tkwin, scrollPtr->hwnd); UpdateScrollbar(scrollPtr); @@ -295,7 +300,11 @@ TkpDisplayScrollbar(clientData) if (scrollPtr->lastVertical != scrollPtr->info.vertical) { HWND hwnd = Tk_GetHWND(Tk_WindowId(tkwin)); +#ifdef _WIN64 + SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) scrollPtr->oldProc); +#else SetWindowLong(hwnd, GWL_WNDPROC, (DWORD) scrollPtr->oldProc); +#endif DestroyWindow(hwnd); CreateProc(tkwin, Tk_WindowId(Tk_Parent(tkwin)), @@ -328,7 +337,11 @@ TkpDestroyScrollbar(scrollPtr) WinScrollbar *winScrollPtr = (WinScrollbar *)scrollPtr; HWND hwnd = winScrollPtr->hwnd; if (hwnd) { +#ifdef _WIN64 + SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) winScrollPtr->oldProc); +#else SetWindowLong(hwnd, GWL_WNDPROC, (DWORD) winScrollPtr->oldProc); +#endif if (winScrollPtr->winFlags & IN_MODAL_LOOP) { ((TkWindow *)scrollPtr->tkwin)->flags |= TK_DONT_DESTROY_WINDOW; SetParent(hwnd, NULL); diff --git a/win/tkWinWm.c b/win/tkWinWm.c index fdfc4cf..bb2ad54 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.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: tkWinWm.c,v 1.26 2000/07/06 03:17:45 mo Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.27 2000/11/03 01:22:17 hobbs Exp $ */ #include "tkWinInt.h" @@ -406,7 +406,11 @@ GetTopLevel(hwnd) if (tsdPtr->createWindow) { return tsdPtr->createWindow; } +#ifdef _WIN64 + return (TkWindow *) GetWindowLongPtr(hwnd, GWLP_USERDATA); +#else return (TkWindow *) GetWindowLong(hwnd, GWL_USERDATA); +#endif } /* @@ -755,7 +759,11 @@ UpdateWrapper(winPtr) Tcl_DStringValue(&titleString), wmPtr->style, x, y, width, height, parentHWND, NULL, Tk_GetHINSTANCE(), NULL); Tcl_DStringFree(&titleString); +#ifdef _WIN64 + SetWindowLongPtr(wmPtr->wrapper, GWLP_USERDATA, (LONG_PTR) winPtr); +#else SetWindowLong(wmPtr->wrapper, GWL_USERDATA, (LONG) winPtr); +#endif tsdPtr->createWindow = NULL; place.length = sizeof(WINDOWPLACEMENT); @@ -772,15 +780,28 @@ UpdateWrapper(winPtr) * Windows doesn't try to set the focus to the child window. */ +#ifdef _WIN64 + SetWindowLongPtr(child, GWL_STYLE, + WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); +#else SetWindowLong(child, GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); +#endif if (winPtr->flags & TK_EMBEDDED) { +#ifdef _WIN64 + SetWindowLongPtr(child, GWLP_WNDPROC, (LONG_PTR) TopLevelProc); +#else SetWindowLong(child, GWL_WNDPROC, (LONG) TopLevelProc); +#endif } oldWrapper = SetParent(child, wmPtr->wrapper); if (oldWrapper && (oldWrapper != wmPtr->wrapper) && (oldWrapper != GetDesktopWindow())) { +#ifdef _WIN64 + SetWindowLongPtr(oldWrapper, GWLP_USERDATA, (LONG) NULL); +#else SetWindowLong(oldWrapper, GWL_USERDATA, (LONG) NULL); +#endif if (wmPtr->numTransients > 0) { /* @@ -4198,7 +4219,7 @@ WmProc(hwnd, message, wParam, lParam) LPARAM lParam; { static int inMoveSize = 0; - static oldMode; /* This static is set upon entering move/size mode + static int oldMode; /* This static is set upon entering move/size mode * and is used to reset the service mode after * leaving move/size mode. Note that this mechanism * assumes move/size is only one level deep. */ |