From 6c73f7395ba610c3ce7549f9ebdccaf24829b8ea Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Fri, 15 Dec 2006 15:03:43 +0800 Subject: [PATCH] user32: Add support for the VK_APPS (Menu) key. --- dlls/user32/message.c | 6 ++++++ dlls/user32/tests/msg.c | 18 ++++++++++++++++++ dlls/winex11.drv/keyboard.c | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 94d29d8ce7c..89f749545c7 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -1660,6 +1660,12 @@ static BOOL process_keyboard_message( MSG *msg, UINT hw_id, HWND hwnd_filter, SendMessageW(msg->hwnd, WM_APPCOMMAND, (WPARAM)msg->hwnd, MAKELPARAM(0, (FAPPCOMMAND_KEY | (msg->wParam - VK_BROWSER_BACK + 1)))); } } + else if (msg->message == WM_KEYUP) + { + /* Handle VK_APPS key by posting a WM_CONTEXTMENU message */ + if (msg->wParam == VK_APPS && !MENU_IsMenuActive()) + PostMessageW(msg->hwnd, WM_CONTEXTMENU, (WPARAM)msg->hwnd, (LPARAM)-1); + } } if (HOOK_CallHooks( WH_KEYBOARD, remove ? HC_ACTION : HC_NOREMOVE, diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 5b74cc4a9be..98a122943fa 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -5288,6 +5288,17 @@ static const struct message WmF1Seq[] = { { WM_KEYUP, sent|wparam|lparam, VK_F1, 0xc0000001 }, { 0 } }; +static const struct message WmVkAppsSeq[] = { + { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_APPS, 1 }, /* XP */ + { WM_KEYDOWN, wparam|lparam, VK_APPS, 1 }, + { WM_KEYDOWN, sent|wparam|lparam, VK_APPS, 0x00000001 }, + { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_APPS, 0xc0000001 }, /* XP */ + { WM_KEYUP, wparam|lparam, VK_APPS, 0xc0000001 }, + { WM_KEYUP, sent|wparam|lparam, VK_APPS, 0xc0000001 }, + { WM_CONTEXTMENU, lparam, /*hwnd*/0, (LPARAM)-1 }, + { WM_CONTEXTMENU, sent|lparam, /*hwnd*/0, (LPARAM)-1 }, + { 0 } +}; static void pump_msg_loop(HWND hwnd, HACCEL hAccel) { @@ -5495,11 +5506,18 @@ static void test_accelerators(void) pump_msg_loop(hwnd, 0); ok_sequence(WmAltMouseButton, "Alt+MouseButton press/release", FALSE); + trace("testing VK_F1 press/release\n"); keybd_event(VK_F1, 0, 0, 0); keybd_event(VK_F1, 0, KEYEVENTF_KEYUP, 0); pump_msg_loop(hwnd, 0); ok_sequence(WmF1Seq, "F1 press/release", TRUE); + trace("testing VK_APPS press/release\n"); + keybd_event(VK_APPS, 0, 0, 0); + keybd_event(VK_APPS, 0, KEYEVENTF_KEYUP, 0); + pump_msg_loop(hwnd, 0); + ok_sequence(WmVkAppsSeq, "VK_APPS press/release", FALSE); + DestroyWindow(hwnd); } diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 19d36849ac9..c5947cfb735 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1001,7 +1001,7 @@ static const WORD nonchar_key_vkey[256] = VK_DOWN, VK_PRIOR, VK_NEXT, VK_END, 0, 0, 0, 0, 0, 0, 0, 0, /* FF58 */ /* misc keys */ - VK_SELECT, VK_SNAPSHOT, VK_EXECUTE, VK_INSERT, 0, 0, 0, 0, /* FF60 */ + VK_SELECT, VK_SNAPSHOT, VK_EXECUTE, VK_INSERT, 0,0,0, VK_APPS, /* FF60 */ 0, VK_CANCEL, VK_HELP, VK_CANCEL, 0, 0, 0, 0, /* FF68 */ 0, 0, 0, 0, 0, 0, 0, 0, /* FF70 */ /* keypad keys */ -- 2.11.4.GIT