diff options
author | hobbs <hobbs> | 2009-09-14 23:39:52 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2009-09-14 23:39:52 (GMT) |
commit | 325b50d61de3cb9a554a0139986c653ae4f9fabc (patch) | |
tree | 8330aec7168a2742b5ccb9ff774da9e8eff021e5 | |
parent | 561fac1ac648b89b1ff1bbc510e969e72be131ce (diff) | |
download | tk-325b50d61de3cb9a554a0139986c653ae4f9fabc.zip tk-325b50d61de3cb9a554a0139986c653ae4f9fabc.tar.gz tk-325b50d61de3cb9a554a0139986c653ae4f9fabc.tar.bz2 |
* generic/tkMenuDraw.c (TkPostSubmenu): Fix reposting of submenu in
* win/tkWinMenu.c (TkWinHandleMenuEvent): torn off Windows menu.
[Bug 873613]
(DrawMenuEntryArrow): Draw Win menu arrow after being torn
off. [Bug 873608]
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | generic/tkMenuDraw.c | 5 | ||||
-rw-r--r-- | win/tkWinMenu.c | 25 |
3 files changed, 32 insertions, 6 deletions
@@ -1,3 +1,11 @@ +2009-09-14 Jeff Hobbs <jeffh@ActiveState.com> + + * generic/tkMenuDraw.c (TkPostSubmenu): Fix reposting of submenu in + * win/tkWinMenu.c (TkWinHandleMenuEvent): torn off Windows menu. + [Bug 873613] + (DrawMenuEntryArrow): Draw Win menu arrow after being torn + off. [Bug 873608] + 2009-08-24 Daniel Steffen <das@users.sourceforge.net> * macosx/tkMacOSXHLEvents.c (ScriptHandler): fix "do script" apple diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c index 2df7a6d..607328c 100644 --- a/generic/tkMenuDraw.c +++ b/generic/tkMenuDraw.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: tkMenuDraw.c,v 1.3.20.2 2003/11/12 00:04:53 hobbs Exp $ + * RCS: @(#) $Id: tkMenuDraw.c,v 1.3.20.3 2009/09/14 23:39:52 hobbs Exp $ */ #include "tkMenu.h" @@ -1009,11 +1009,12 @@ TkPostSubmenu(interp, menuPtr, mePtr) name = Tcl_GetStringFromObj(mePtr->namePtr, NULL); Tk_GetRootCoords(menuPtr->tkwin, &x, &y); AdjustMenuCoords(menuPtr, mePtr, &x, &y, string); + menuPtr->postedCascade = mePtr; result = Tcl_VarEval(interp, "{", name, "} post ", string, (char *) NULL); if (result != TCL_OK) { + menuPtr->postedCascade = NULL; return result; } - menuPtr->postedCascade = mePtr; TkEventuallyRedrawMenu(menuPtr, mePtr); } return TCL_OK; diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index cf91c1f..744869f 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.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: tkWinMenu.c,v 1.21.2.9 2007/06/09 23:52:40 hobbs Exp $ + * RCS: @(#) $Id: tkWinMenu.c,v 1.21.2.10 2009/09/14 23:39:53 hobbs Exp $ */ #define OEMRESOURCE @@ -52,6 +52,10 @@ #define MENU_SYSTEM_MENU MENU_PLATFORM_FLAG1 #define MENU_RECONFIGURE_PENDING MENU_PLATFORM_FLAG2 +#ifndef WM_UNINITMENUPOPUP +#define WM_UNINITMENUPOPUP 0x0125 +#endif + static int indicatorDimensions[2]; /* The dimensions of the indicator space * in a menu entry. Calculated at init @@ -940,6 +944,19 @@ TkWinHandleMenuEvent(phwnd, pMessage, pwParam, plParam, plResult) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); switch (*pMessage) { + case WM_UNINITMENUPOPUP: + hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, + (char *) *pwParam); + if (hashEntryPtr != NULL) { + menuPtr = (TkMenu *) Tcl_GetHashValue(hashEntryPtr); + if ((menuPtr->menuRefPtr != NULL) + && (menuPtr->menuRefPtr->parentEntryPtr != NULL)) { + TkPostSubmenu(menuPtr->interp, + menuPtr->menuRefPtr->parentEntryPtr->menuPtr, NULL); + } + } + break; + case WM_INITMENU: TkMenuInit(); hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, @@ -1726,8 +1743,7 @@ DrawMenuEntryArrow(menuPtr, mePtr, d, gc, COLORREF oldBgColor; RECT rect; - if (!drawArrow || (mePtr->type != CASCADE_ENTRY) || - (mePtr->state != ENTRY_DISABLED)) + if (!drawArrow || (mePtr->type != CASCADE_ENTRY)) return; oldFgColor = gc->foreground; @@ -1743,7 +1759,8 @@ DrawMenuEntryArrow(menuPtr, mePtr, d, gc, gc->background = activeBgColor->pixel; } - gc->foreground = GetSysColor(COLOR_GRAYTEXT); + gc->foreground = GetSysColor((mePtr->state == ENTRY_DISABLED) ? + COLOR_GRAYTEXT : COLOR_MENUTEXT); rect.top = y + GetSystemMetrics(SM_CYBORDER); rect.bottom = y + height - GetSystemMetrics(SM_CYBORDER); |