summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2007-12-05 19:07:59 (GMT)
committerhobbs <hobbs>2007-12-05 19:07:59 (GMT)
commit0d077f2a7cafa16f82ed232f0d14f2d99f0921e4 (patch)
tree669e1fed3026d9e8eccee0fd82963040db2e2129
parent7e7893fe4ebe4a4a67623d2fcf69d117cf4039dc (diff)
downloadtk-0d077f2a7cafa16f82ed232f0d14f2d99f0921e4.zip
tk-0d077f2a7cafa16f82ed232f0d14f2d99f0921e4.tar.gz
tk-0d077f2a7cafa16f82ed232f0d14f2d99f0921e4.tar.bz2
* win/tkWinButton.c, win/tkWinDialog.c: use SetWindowLongPtr and
* win/tkWinScrlbr.c, win/tkWinWm.c: GetWindowLongPtr only. * win/ttkWinMonitor.c:
-rw-r--r--ChangeLog4
-rw-r--r--win/tkWinButton.c11
-rw-r--r--win/tkWinDialog.c11
-rw-r--r--win/tkWinScrlbr.c15
-rw-r--r--win/tkWinWm.c35
-rw-r--r--win/ttkWinMonitor.c10
6 files changed, 9 insertions, 77 deletions
diff --git a/ChangeLog b/ChangeLog
index 9fabeda..b749c28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2007-12-05 Jeff Hobbs <jeffh@ActiveState.com>
+ * win/tkWinButton.c, win/tkWinDialog.c: use SetWindowLongPtr and
+ * win/tkWinScrlbr.c, win/tkWinWm.c: GetWindowLongPtr only.
+ * win/ttkWinMonitor.c:
+
* win/tkWinInt.h: remove CS_CLASSDC (not recommended for any apps now)
* win/tkWinX.c: and simplify WNDCLASS to one style.
* win/tkWinWm.c: Reduce wrapper update for exStyle to toolwindow
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index 7a1ed35..63ccf24 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.31 2007/01/11 15:35:40 dkf Exp $
+ * RCS: @(#) $Id: tkWinButton.c,v 1.32 2007/12/05 19:08:00 hobbs Exp $
*/
#define OEMRESOURCE
@@ -274,13 +274,8 @@ CreateProc(
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;
@@ -310,11 +305,7 @@ TkpDestroyButton(
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 b3203fd..20029b0 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -8,7 +8,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.47 2007/10/25 21:44:23 hobbs Exp $
+ * RCS: @(#) $Id: tkWinDialog.c,v 1.48 2007/12/05 19:08:00 hobbs Exp $
*
*/
@@ -124,21 +124,12 @@ static const struct {int type; int btnIds[3];} allowedTypes[] = {
* Abstract trivial differences between Win32 and Win64.
*/
-#ifdef _WIN64
#define TkWinGetHInstance(from) \
((HINSTANCE) GetWindowLongPtr((from), GWLP_HINSTANCE))
#define TkWinGetUserData(from) \
GetWindowLongPtr((from), GWLP_USERDATA)
#define TkWinSetUserData(to,what) \
SetWindowLongPtr((to), GWLP_USERDATA, (LPARAM)(what))
-#else
-#define TkWinGetHInstance(from) \
- ((HINSTANCE) GetWindowLong((from), GWL_HINSTANCE))
-#define TkWinGetUserData(from) \
- GetWindowLong((from), GWL_USERDATA)
-#define TkWinSetUserData(to,what) \
- SetWindowLong((to), GWL_USERDATA, (LPARAM)(what))
-#endif
/*
* The value of TK_MULTI_MAX_PATH dictactes how many files can be retrieved
diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c
index 742c941..12bd505 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.12 2005/12/02 13:42:29 dkf Exp $
+ * RCS: @(#) $Id: tkWinScrlbr.c,v 1.13 2007/12/05 19:08:00 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -255,13 +255,8 @@ CreateProc(
}
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);
@@ -306,11 +301,7 @@ TkpDisplayScrollbar(
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)),
@@ -344,11 +335,7 @@ TkpDestroyScrollbar(
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 11a82ca..adf6a62 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.120 2007/12/05 19:01:48 hobbs Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.121 2007/12/05 19:08:00 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -1081,17 +1081,10 @@ WinSetIcon(
* checked.
*/
-#ifdef _WIN64
SetClassLongPtr(hwnd, GCLP_HICONSM,
(LPARAM) GetIcon(titlebaricon, ICON_SMALL));
SetClassLongPtr(hwnd, GCLP_HICON,
(LPARAM) GetIcon(titlebaricon, ICON_BIG));
-#else
- SetClassLong(hwnd, GCL_HICONSM,
- (LPARAM) GetIcon(titlebaricon, ICON_SMALL));
- SetClassLong(hwnd, GCL_HICON,
- (LPARAM) GetIcon(titlebaricon, ICON_BIG));
-#endif
tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->iconPtr != NULL) {
@@ -1228,13 +1221,8 @@ TkWinGetIcon(
icon = (HICON) SendMessage(wmPtr->wrapper, WM_GETICON, iconsize,
(LPARAM) NULL);
if (icon == (HICON) NULL) {
-#ifdef _WIN64
icon = (HICON) GetClassLongPtr(wmPtr->wrapper,
(iconsize == ICON_BIG) ? GCLP_HICON : GCLP_HICONSM);
-#else
- icon = (HICON) GetClassLong(wmPtr->wrapper,
- (iconsize == ICON_BIG) ? GCL_HICON : GCL_HICONSM);
-#endif
}
return icon;
}
@@ -1815,11 +1803,7 @@ GetTopLevel(
if (tsdPtr->createWindow) {
return tsdPtr->createWindow;
}
-#ifdef _WIN64
return (TkWindow *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
-#else
- return (TkWindow *) GetWindowLong(hwnd, GWL_USERDATA);
-#endif
}
/*
@@ -2212,11 +2196,7 @@ UpdateWrapper(
parentHWND, NULL, Tk_GetHINSTANCE(), NULL);
Tcl_DStringFree(&classString);
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;
if ((wmPtr->exStyleConfig & WS_EX_LAYERED)
@@ -2266,20 +2246,11 @@ UpdateWrapper(
* 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
}
SetParent(child, wmPtr->wrapper);
@@ -2292,11 +2263,7 @@ UpdateWrapper(
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) {
/*
diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c
index cdfc2e6..2856365 100644
--- a/win/ttkWinMonitor.c
+++ b/win/ttkWinMonitor.c
@@ -1,4 +1,4 @@
-/* $Id: ttkWinMonitor.c,v 1.13 2007/10/25 07:08:26 jenglish Exp $
+/* $Id: ttkWinMonitor.c,v 1.14 2007/12/05 19:08:00 hobbs Exp $
*/
#ifdef _MSC_VER
@@ -96,11 +96,7 @@ CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp)
hwnd = CreateWindow( name, title, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hinst, NULL );
-#ifdef _WIN64
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG)interp);
-#else
- SetWindowLong(hwnd, GWL_USERDATA, (LONG)interp);
-#endif
ShowWindow(hwnd, SW_HIDE);
UpdateWindow(hwnd);
}
@@ -117,11 +113,7 @@ DestroyThemeMonitorWindow(void *clientData)
static LRESULT WINAPI
WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
-#ifdef _WIN64
Tcl_Interp *interp = (Tcl_Interp *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
-#else
- Tcl_Interp *interp = (Tcl_Interp *)GetWindowLong(hwnd, GWL_USERDATA);
-#endif
Ttk_Theme theme;
switch (msg) {