Fabian Maurer : user32: Don' t send WM_CHAR when a menu gets VK_ESCAPE and add tests.
Alexandre Julliard
julliard at winehq.org
Fri Feb 3 13:31:32 CST 2017
Module: wine
Branch: master
Commit: 115bbf424cc0f5ea325e3052aed8ad8106045294
URL: http://source.winehq.org/git/wine.git/?a=commit;h=115bbf424cc0f5ea325e3052aed8ad8106045294
Author: Fabian Maurer <dark.shadow4 at web.de>
Date: Thu Feb 2 16:33:54 2017 +0100
user32: Don't send WM_CHAR when a menu gets VK_ESCAPE and add tests.
Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/menu.c | 2 +-
dlls/user32/tests/msg.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 59fcd9c..827bee7 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -3077,7 +3077,6 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
break;
}
- TranslateMessage( &msg );
mt.pt = msg.pt;
if ( (msg.hwnd==menu->hWnd) || (msg.message!=WM_TIMER) )
@@ -3206,6 +3205,7 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
}
default:
+ TranslateMessage( &msg );
break;
}
break; /* WM_KEYDOWN */
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 45b5222..c608c11 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -1675,6 +1675,10 @@ static const struct message WmTrackPopupMenu[] = {
{ 0 }
};
+static const struct message WmTrackPopupMenuEsc[] = {
+ { 0 }
+};
+
static const struct message WmTrackPopupMenuCapture[] = {
{ HCBT_CREATEWND, hook },
{ WM_ENTERMENULOOP, sent|wparam|lparam, TRUE, 0 },
@@ -15637,6 +15641,7 @@ static LRESULT WINAPI cancel_init_proc(HWND hwnd, UINT message, WPARAM wParam, L
static void test_TrackPopupMenu(void)
{
+ MSG msg;
HWND hwnd;
BOOL ret;
@@ -15659,6 +15664,20 @@ static void test_TrackPopupMenu(void)
ok_sequence(WmTrackPopupMenu, "TrackPopupMenu", TRUE);
ok(ret == 1, "TrackPopupMenu failed with error %i\n", GetLastError());
+ /* Test popup closing with an ESC-press */
+ flush_events();
+ PostMessageW(hwnd, WM_KEYDOWN, VK_ESCAPE, 0);
+ ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL);
+ ok(ret == 1, "TrackPopupMenu failed with error %i\n", GetLastError());
+ PostQuitMessage(0);
+ flush_sequence();
+ while ( PeekMessageA(&msg, 0, 0, 0, PM_REMOVE) )
+ {
+ TranslateMessage(&msg);
+ DispatchMessageA(&msg);
+ }
+ ok_sequence(WmTrackPopupMenuEsc, "TrackPopupMenuEsc", FALSE); /* Shouldn't get any message */
+
SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)cancel_init_proc);
flush_events();
More information about the wine-cvs
mailing list