From f590d202080c26d797acadcbe6ba072adf79b3e3 Mon Sep 17 00:00:00 2001 From: patthoyts Date: Fri, 14 Dec 2007 15:56:08 +0000 Subject: Add in missing function definitions to support plain MSVC6 and use INT_PTR rather than LONG_PTR which isn'tr defined in the msvc6 headers. --- ChangeLog | 7 +++++++ win/tkWinButton.c | 6 +++--- win/tkWinInt.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- win/tkWinScrlbr.c | 8 ++++---- win/tkWinWm.c | 30 +++--------------------------- 5 files changed, 65 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5da1db5..71eb2e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-12-14 Pat Thoyts + + * win/tkWinInt.h: Add in missing function definitions + * win/tkWinButton.c: to support plain MSVC6 and use INT_PTR + * win/tkWinScrlBar.c: rather than LONG_PTR which isn'tr defined + * win/tkWinWm.c: in the msvc6 headers. + 2007-12-14 Pat Thoyts * win/nmakehlp.c: Support compilation with MSVC9 for AMD64. diff --git a/win/tkWinButton.c b/win/tkWinButton.c index f9721ea..5a348b1 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.33 2007/12/13 15:28:52 dgp Exp $ + * RCS: @(#) $Id: tkWinButton.c,v 1.34 2007/12/14 15:56:09 patthoyts Exp $ */ #define OEMRESOURCE @@ -275,7 +275,7 @@ CreateProc( SetWindowPos(butPtr->hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); butPtr->oldProc = (WNDPROC)SetWindowLongPtr(butPtr->hwnd, GWLP_WNDPROC, - (LONG_PTR) ButtonProc); + (INT_PTR) ButtonProc); window = Tk_AttachHWND(tkwin, butPtr->hwnd); return window; @@ -305,7 +305,7 @@ TkpDestroyButton( HWND hwnd = winButPtr->hwnd; if (hwnd) { - SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) winButPtr->oldProc); + SetWindowLongPtr(hwnd, GWLP_WNDPROC, (INT_PTR) winButPtr->oldProc); } } diff --git a/win/tkWinInt.h b/win/tkWinInt.h index 8d72db2..aa35ed0 100644 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinInt.h,v 1.30 2007/12/13 15:28:55 dgp Exp $ + * RCS: @(#) $Id: tkWinInt.h,v 1.31 2007/12/14 15:56:09 patthoyts Exp $ */ #ifndef _TKWININT @@ -248,4 +248,51 @@ long TkpWinToplevelOverrideRedirect(TkWindow *winPtr, void TkpWinToplevelDetachWindow(TkWindow *winPtr); int TkpWmGetState(TkWindow *winPtr); +/* + * The following functions are not present in old versions of Windows + * API headers but are used in the Tk source to ensure 64bit + * compatability. + */ + +#ifndef GetClassLongPtr +# define GetClassLongPtrA GetClassLongA +# define GetClassLongPtrW GetClassLongW +# define SetClassLongPtrA SetClassLongA +# define SetClassLongPtrW SetClassLongW +# ifdef UNICODE +# define GetClassLongPtr GetClassLongPtrW +# define SetClassLongPtr SetClassLongPtrW +# else +# define GetClassLongPtr GetClassLongPtrA +# define SetClassLongPtr SetClassLongPtrA +# endif /* !UNICODE */ +#endif /* !GetClassLongPtr */ +#ifndef GCLP_HICON +# define GCLP_HICON GCL_HICON +#endif /* !GCLP_HICON */ +#ifndef GCLP_HICONSM +# define GCLP_HICONSM (-34) +#endif /* !GCLP_HICONSM */ + +#ifndef GetWindowLongPtr +# define GetWindowLongPtrA GetWindowLongA +# define GetWindowLongPtrW GetWindowLongW +# define SetWindowLongPtrA SetWindowLongA +# define SetWindowLongPtrW SetWindowLongW +# ifdef UNICODE +# define GetWindowLongPtr GetWindowLongPtrW +# define SetWindowLongPtr SetWindowLongPtrW +# else +# define GetWindowLongPtr GetWindowLongPtrW +# define SetWindowLongPtr SetWindowLongPtrW +# endif /* !UNICODE */ +#endif /* !GetWindowLongPtr */ +#ifndef GWLP_WNDPROC +#define GWLP_WNDPROC GWL_WNDPROC +#define GWLP_HINSTANCE GWL_HINSTANCE +#define GWLP_HWNDPARENT GWL_HWNDPARENT +#define GWLP_USERDATA GWL_USERDATA +#define GWLP_ID GWL_ID +#endif /* !GWLP_WNDPROC */ + #endif /* _TKWININT */ diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index ff6b56e..a6f19bc 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.14 2007/12/13 15:28:56 dgp Exp $ + * RCS: @(#) $Id: tkWinScrlbr.c,v 1.15 2007/12/14 15:56:09 patthoyts Exp $ */ #include "tkWinInt.h" @@ -256,7 +256,7 @@ CreateProc( scrollPtr->lastVertical = scrollPtr->info.vertical; scrollPtr->oldProc = (WNDPROC)SetWindowLongPtr(scrollPtr->hwnd, - GWLP_WNDPROC, (LONG_PTR) ScrollbarProc); + GWLP_WNDPROC, (INT_PTR) ScrollbarProc); window = Tk_AttachHWND(tkwin, scrollPtr->hwnd); UpdateScrollbar(scrollPtr); @@ -301,7 +301,7 @@ TkpDisplayScrollbar( if (scrollPtr->lastVertical != scrollPtr->info.vertical) { HWND hwnd = Tk_GetHWND(Tk_WindowId(tkwin)); - SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) scrollPtr->oldProc); + SetWindowLongPtr(hwnd, GWLP_WNDPROC, (INT_PTR) scrollPtr->oldProc); DestroyWindow(hwnd); CreateProc(tkwin, Tk_WindowId(Tk_Parent(tkwin)), @@ -335,7 +335,7 @@ TkpDestroyScrollbar( HWND hwnd = winScrollPtr->hwnd; if (hwnd) { - SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) winScrollPtr->oldProc); + SetWindowLongPtr(hwnd, GWLP_WNDPROC, (INT_PTR) winScrollPtr->oldProc); 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 f647c08..d9fc1ac 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.123 2007/12/13 15:28:56 dgp Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.124 2007/12/14 15:56:09 patthoyts Exp $ */ #include "tkWinInt.h" @@ -563,30 +563,6 @@ static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr); */ #define WIDTHBYTES(bits) ((((bits) + 31)>>5)<<2) - -/* - * Hacks to make this file build with older versions of the SDK. - */ - -#ifndef GetClassLongPtr -# define GetClassLongPtrA GetClassLongA -# define GetClassLongPtrW GetClassLongW -# define SetClassLongPtrA SetClassLongA -# define SetClassLongPtrW SetClassLongW -# ifdef UNICODE -# define GetClassLongPtr GetClassLongPtrW -# define SetClassLongPtr SetClassLongPtrW -# else -# define GetClassLongPtr GetClassLongPtrA -# define SetClassLongPtr SetClassLongPtrA -# endif /* !UNICODE */ -#endif /* !GetClassLongPtr */ -#ifndef GCLP_HICON -# define GCLP_HICON GCL_HICON -#endif /* !GCLP_HICON */ -#ifndef GCLP_HICONSM -# define GCLP_HICONSM (-34) -#endif /* !GCLP_HICONSM */ /* *---------------------------------------------------------------------- @@ -2220,7 +2196,7 @@ UpdateWrapper( parentHWND, NULL, Tk_GetHINSTANCE(), NULL); Tcl_DStringFree(&classString); Tcl_DStringFree(&titleString); - SetWindowLongPtr(wmPtr->wrapper, GWLP_USERDATA, (LONG_PTR) winPtr); + SetWindowLongPtr(wmPtr->wrapper, GWLP_USERDATA, (INT_PTR) winPtr); tsdPtr->createWindow = NULL; if ((wmPtr->exStyleConfig & WS_EX_LAYERED) @@ -2274,7 +2250,7 @@ UpdateWrapper( WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); if (winPtr->flags & TK_EMBEDDED) { - SetWindowLongPtr(child, GWLP_WNDPROC, (LONG_PTR) TopLevelProc); + SetWindowLongPtr(child, GWLP_WNDPROC, (INT_PTR) TopLevelProc); } SetParent(child, wmPtr->wrapper); -- cgit v0.12