user32: Add support for the VK_KEYS (Menu) key

Dmitry Timoshkov dmitry at codeweavers.com
Fri Dec 15 01:03:43 CST 2006


Hello,

Changelog:
    user32: Add support for the VK_KEYS (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 deletions(-)

diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 94d29d8..89f7495 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 5b74cc4..98a1229 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 19d3684..c5947cf 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 */
-- 
1.4.4.2






More information about the wine-patches mailing list