Commit 0bfc8f05 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

user32: Don't emit WM_COMMAND on choosing an item in a context menu (Edit control).

parent 1ba63827
......@@ -3244,14 +3244,11 @@ static LRESULT EDIT_WM_Char(EDITSTATE *es, WCHAR c)
/*********************************************************************
*
* WM_COMMAND
* EDIT_ContextMenuCommand
*
*/
static void EDIT_WM_Command(EDITSTATE *es, INT code, INT id, HWND control)
static void EDIT_ContextMenuCommand(EDITSTATE *es, UINT id)
{
if (code || control)
return;
switch (id) {
case EM_UNDO:
SendMessageW(es->hwndSelf, WM_UNDO, 0, 0);
......@@ -3301,6 +3298,7 @@ static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y)
HMENU popup = GetSubMenu(menu, 0);
UINT start = es->selection_start;
UINT end = es->selection_end;
UINT cmd;
ORDER_UINT(start, end);
......@@ -3329,7 +3327,12 @@ static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y)
if (!(es->flags & EF_FOCUSED))
SetFocus(es->hwndSelf);
TrackPopupMenu(popup, TPM_LEFTALIGN | TPM_RIGHTBUTTON, x, y, 0, es->hwndSelf, NULL);
cmd = TrackPopupMenu(popup, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY,
x, y, 0, es->hwndSelf, NULL);
if (cmd)
EDIT_ContextMenuCommand(es, cmd);
DestroyMenu(menu);
}
......@@ -4984,10 +4987,6 @@ LRESULT EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, B
EDIT_WM_Clear(es);
break;
case WM_COMMAND:
EDIT_WM_Command(es, HIWORD(wParam), LOWORD(wParam), (HWND)lParam);
break;
case WM_CONTEXTMENU:
EDIT_WM_ContextMenu(es, (short)LOWORD(lParam), (short)HIWORD(lParam));
break;
......
......@@ -2323,7 +2323,7 @@ static void test_contextmenu(void)
SendMessageA(hwndEdit, WM_SETTEXT, 0, (LPARAM)"foo");
SendMessageA(hwndEdit, WM_CONTEXTMENU, (WPARAM)hwndEdit, MAKEWORD(-1, -1));
while (PeekMessageA(&msg, hwndEdit, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
todo_wine ok(menu_messages.wm_command == 0,
ok(menu_messages.wm_command == 0,
"Expected no WM_COMMAND messages, got %d\n", menu_messages.wm_command);
todo_wine ok(menu_messages.em_setsel == 1,
"Expected 1 EM_SETSEL message, got %d\n", menu_messages.em_setsel);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment