diff options
author | dgp <dgp@users.sourceforge.net> | 2007-12-05 20:26:46 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2007-12-05 20:26:46 (GMT) |
commit | 052769d3429842c878d3f69a27ab2075e1cb44b8 (patch) | |
tree | 2d9c8a2a6863dcac4a4cd219f9580c43b510b30e | |
parent | 8fb134c7b3563ffd9f518c2c75271ee5d2063998 (diff) | |
download | tk-052769d3429842c878d3f69a27ab2075e1cb44b8.zip tk-052769d3429842c878d3f69a27ab2075e1cb44b8.tar.gz tk-052769d3429842c878d3f69a27ab2075e1cb44b8.tar.bz2 |
merge updates from HEAD
-rw-r--r-- | ChangeLog | 15 | ||||
-rwxr-xr-x | win/configure | 3 | ||||
-rw-r--r-- | win/tcl.m4 | 3 | ||||
-rw-r--r-- | win/tkWinButton.c | 11 | ||||
-rw-r--r-- | win/tkWinDialog.c | 11 | ||||
-rw-r--r-- | win/tkWinInt.h | 3 | ||||
-rw-r--r-- | win/tkWinScrlbr.c | 15 | ||||
-rw-r--r-- | win/tkWinWm.c | 128 | ||||
-rw-r--r-- | win/tkWinX.c | 16 | ||||
-rw-r--r-- | win/ttkWinMonitor.c | 10 |
10 files changed, 53 insertions, 162 deletions
@@ -1,3 +1,18 @@ +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 + change only and set WS_EX_LAYERED as sticky (once set on a window, + do not remove it) to reduce alpha transition flicker. + + * win/configure, win/tcl.m4 (LIBS_GUI): mingw needs -lole32 + -loleaut32 but not msvc for Tk's [send]. [Bug 1844749] + 2007-12-04 Joe English <jenglish@users.sourceforge.net> * doc/ttk_style.n: Remove nonsense about "this manpage has diff --git a/win/configure b/win/configure index 5f56e1d..e48016c 100755 --- a/win/configure +++ b/win/configure @@ -2732,7 +2732,8 @@ echo "$as_me: WARNING: 64bit mode not supported with GCC on Windows" >&2;} SHLIB_LD="" SHLIB_LD_LIBS="" LIBS="-lws2_32" - LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid" + # mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't + LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32" STLIB_LD='${AR} cr' RC_OUT=-o RC_TYPE= @@ -447,7 +447,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ SHLIB_LD="" SHLIB_LD_LIBS="" LIBS="-lws2_32" - LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid" + # mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't + LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32" STLIB_LD='${AR} cr' RC_OUT=-o RC_TYPE= diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 7a1ed35..b10d31c 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.31.2.1 2007/12/05 20:26:46 dgp 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 20f9203..0c356eb 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.44.2.3 2007/10/27 04:23:18 dgp Exp $ + * RCS: @(#) $Id: tkWinDialog.c,v 1.44.2.4 2007/12/05 20:26:46 dgp 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/tkWinInt.h b/win/tkWinInt.h index c6ba4f7..d890cd5 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.28 2007/05/04 21:29:23 patthoyts Exp $ + * RCS: @(#) $Id: tkWinInt.h,v 1.28.2.1 2007/12/05 20:26:47 dgp Exp $ */ #ifndef _TKWININT @@ -121,7 +121,6 @@ typedef struct { */ #define TK_WIN_TOPLEVEL_CLASS_NAME "TkTopLevel" -#define TK_WIN_TOPLEVEL_NOCDC_CLASS_NAME "TkTopLevelNoCDC" #define TK_WIN_CHILD_CLASS_NAME "TkChild" /* diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index 742c941..6278ebc 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.12.2.1 2007/12/05 20:26:47 dgp 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 1e00394..1a158f7 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.116.2.3 2007/10/16 04:03:55 dgp Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.116.2.4 2007/12/05 20:26:47 dgp Exp $ */ #include "tkWinInt.h" @@ -936,20 +936,7 @@ InitWindowClass( ZeroMemory(&class, sizeof(WNDCLASS)); - /* - * When threads are enabled, we cannot use CLASSDC because threads - * will then write into the same device context. - * - * This is a hack; we should add a subsystem that manages device - * context on a per-thread basis. See also tkWinX.c, which also - * initializes a WNDCLASS structure. - */ - -#ifdef TCL_THREADS class.style = CS_HREDRAW | CS_VREDRAW; -#else - class.style = CS_HREDRAW | CS_VREDRAW | CS_CLASSDC; -#endif class.hInstance = Tk_GetHINSTANCE(); Tcl_WinUtfToTChar(TK_WIN_TOPLEVEL_CLASS_NAME, -1, &classString); class.lpszClassName = (LPCTSTR) Tcl_DStringValue(&classString); @@ -975,23 +962,6 @@ InitWindowClass( Tcl_Panic("Unable to register TkTopLevel class"); } -#ifndef TCL_THREADS - /* - * Use of WS_EX_LAYERED disallows CS_CLASSDC, as does TCL_THREADS - * usage, so only create this if necessary. - */ - - if (setLayeredWindowAttributesProc != NULL) { - class.style = CS_HREDRAW | CS_VREDRAW; - Tcl_DStringFree(&classString); - Tcl_WinUtfToTChar(TK_WIN_TOPLEVEL_NOCDC_CLASS_NAME, - -1, &classString); - class.lpszClassName = (LPCTSTR) Tcl_DStringValue(&classString); - if (!(*tkWinProcs->registerClass)(&class)) { - Tcl_Panic("Unable to register TkTopLevelNoCDC class"); - } - } -#endif Tcl_DStringFree(&classString); } Tcl_MutexUnlock(&winWmMutex); @@ -1111,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) { @@ -1258,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; } @@ -1845,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 } /* @@ -1988,17 +1942,6 @@ TkWinWmCleanup( tsdPtr->initialized = 0; UnregisterClass(TK_WIN_TOPLEVEL_CLASS_NAME, hInstance); - -#ifndef TCL_THREADS - /* - * Clean up specialized class created for layered windows. - */ - - if (setLayeredWindowAttributesProc != NULL) { - UnregisterClass(TK_WIN_TOPLEVEL_NOCDC_CLASS_NAME, hInstance); - setLayeredWindowAttributesProc = NULL; - } -#endif } /* @@ -2244,19 +2187,7 @@ UpdateWrapper( Tcl_WinUtfToTChar(((wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid), -1, &titleString); -#ifndef TCL_THREADS - /* - * Transparent windows require a non-CS_CLASSDC window class. - */ - if ((wmPtr->exStyleConfig & WS_EX_LAYERED) - && setLayeredWindowAttributesProc != NULL) { - Tcl_WinUtfToTChar(TK_WIN_TOPLEVEL_NOCDC_CLASS_NAME, - -1, &classString); - } else -#endif - { - Tcl_WinUtfToTChar(TK_WIN_TOPLEVEL_CLASS_NAME, -1, &classString); - } + Tcl_WinUtfToTChar(TK_WIN_TOPLEVEL_CLASS_NAME, -1, &classString); wmPtr->wrapper = (*tkWinProcs->createWindowEx)(wmPtr->exStyle, (LPCTSTR) Tcl_DStringValue(&classString), @@ -2265,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) @@ -2319,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); @@ -2345,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) { /* @@ -3166,7 +3080,7 @@ WmAttributesCmd( LONG style, exStyle, styleBit, *stylePtr = NULL; char *string; int i, boolean, length; - int config_fullscreen = 0; + int config_fullscreen = 0, updatewrapper = 0; int fullscreen_attr_changed = 0, fullscreen_attr = 0; if ((objc < 3) || ((objc > 5) && ((objc%2) == 0))) { @@ -3231,6 +3145,12 @@ WmAttributesCmd( && (strncmp(string, "-toolwindow", (unsigned) length) == 0)) { stylePtr = &exStyle; styleBit = WS_EX_TOOLWINDOW; + if (objc != 4) { + /* + * Changes to toolwindow style require an update + */ + updatewrapper = 1; + } } else if ((length > 3) && (strncmp(string, "-topmost", (unsigned) length) == 0)) { stylePtr = &exStyle; @@ -3299,10 +3219,14 @@ WmAttributesCmd( } } + /* + * Only ever add the WS_EX_LAYERED bit, as it can cause + * flashing to change this window style. This allows things + * like fading tooltips to avoid flash ugliness without + * forcing all window to be layered. + */ if ((wmPtr->alpha < 1.0) || (wmPtr->crefObj != NULL)) { *stylePtr |= styleBit; - } else { - *stylePtr &= ~styleBit; } if ((setLayeredWindowAttributesProc != NULL) && (wmPtr->wrapper != NULL)) { @@ -3313,6 +3237,10 @@ WmAttributesCmd( * translation. Add the 0.5 to round the value. */ + if (!(wmPtr->exStyleConfig & WS_EX_LAYERED)) { + SetWindowLongPtr(wmPtr->wrapper, GWL_EXSTYLE, + *stylePtr); + } setLayeredWindowAttributesProc((HWND) wmPtr->wrapper, wmPtr->colorref, (BYTE) (wmPtr->alpha * 255 + 0.5), (unsigned) (LWA_ALPHA | @@ -3368,14 +3296,16 @@ WmAttributesCmd( } } if (wmPtr->exStyleConfig != exStyle) { - /* - * UpdateWrapper ensure that all effects are properly handled, such as - * TOOLWINDOW disappearing from the taskbar. - */ - wmPtr->exStyleConfig = exStyle; - if (!(wmPtr->flags & WM_NEVER_MAPPED)) { - UpdateWrapper(winPtr); + if (updatewrapper) { + /* + * UpdateWrapper ensure that all effects are properly handled, + * such as TOOLWINDOW disappearing from the taskbar. + */ + + if (!(wmPtr->flags & WM_NEVER_MAPPED)) { + UpdateWrapper(winPtr); + } } } if (fullscreen_attr_changed) { @@ -3772,7 +3702,6 @@ WmForgetCmd(tkwin, winPtr, interp, objc, objv) Tcl_Obj *CONST objv[]; /* Argument objects. */ { register Tk_Window frameWin = (Tk_Window)winPtr; - char *oldClass = (char*)Tk_Class(frameWin); if (Tk_IsTopLevel(frameWin)) { Tk_UnmapWindow(frameWin); @@ -4669,7 +4598,6 @@ WmManageCmd(tkwin, winPtr, interp, objc, objv) { register Tk_Window frameWin = (Tk_Window)winPtr; register WmInfo *wmPtr = winPtr->wmInfoPtr; - char *oldClass = (char*)Tk_Class(frameWin); if (!Tk_IsTopLevel(frameWin)) { TkFocusSplit(winPtr); diff --git a/win/tkWinX.c b/win/tkWinX.c index 145eb6d..b6f34ff 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -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: tkWinX.c,v 1.55 2007/01/11 15:35:41 dkf Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.55.2.1 2007/12/05 20:26:47 dgp Exp $ */ /* @@ -274,21 +274,7 @@ TkWinXInit( tkWinProcs = &asciiProcs; } - /* - * When threads are enabled, we cannot use CLASSDC because threads will - * then write into the same device context. - * - * This is a hack; we should add a subsystem that manages device context - * on a per-thread basis. See also tkWinWm.c, which also initializes a - * WNDCLASS structure. - */ - -#ifdef TCL_THREADS childClass.style = CS_HREDRAW | CS_VREDRAW; -#else - childClass.style = CS_HREDRAW | CS_VREDRAW | CS_CLASSDC; -#endif - childClass.cbClsExtra = 0; childClass.cbWndExtra = 0; childClass.hInstance = hInstance; diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c index f6a74ea..a5580a2 100644 --- a/win/ttkWinMonitor.c +++ b/win/ttkWinMonitor.c @@ -1,4 +1,4 @@ -/* $Id: ttkWinMonitor.c,v 1.10.2.3 2007/10/27 04:23:18 dgp Exp $ +/* $Id: ttkWinMonitor.c,v 1.10.2.4 2007/12/05 20:26:47 dgp 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) { |