From f6dc11e9b589ae80a6665424b94c5e23567ea9d6 Mon Sep 17 00:00:00 2001
From: Joerg Bornemann <joerg.bornemann@qt.io>
Date: Fri, 8 Sep 2017 12:13:51 +0200
Subject: [PATCH] Fix translation of Qt::Key_Menu

VK_MENU is the virtual key code for the Alt key, but
Qt::Key_Menu is the context menu key which maps to VK_APPS.

Now the menu key can be used to invoke the context menu on web pages.

Task-number: QTBUG-58306
Change-Id: I8674ab84848b5c8732e4d0cf189909191b85d562
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
---
 src/core/web_event_factory.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp
index 7853986b0..f5264708d 100644
--- a/src/core/web_event_factory.cpp
+++ b/src/core/web_event_factory.cpp
@@ -144,7 +144,6 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad)
             return VK_SHIFT; // (10) SHIFT key
         case Qt::Key_Control:
             return VK_CONTROL; // (11) CTRL key
-        case Qt::Key_Menu:
         case Qt::Key_Alt:
             return VK_MENU; // (12) ALT key
         default:
@@ -167,7 +166,6 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad)
             return VK_SHIFT; // (10) SHIFT key
         case Qt::Key_Control:
             return VK_CONTROL; // (11) CTRL key
-        case Qt::Key_Menu:
         case Qt::Key_Alt:
             return VK_MENU; // (12) ALT key
 
@@ -357,7 +355,8 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad)
             return VK_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard)
             // case Qt::Key_Meta_R: FIXME: What to do here?
             //    return VK_RWIN; // (5C) Right Windows key (Natural keyboard)
-            // VK_APPS (5D) Applications key (Natural keyboard)
+        case Qt::Key_Menu: // (5D) Applications key (Natural keyboard)
+            return VK_APPS;
             // VK_SLEEP (5F) Computer Sleep key
             // VK_SEPARATOR (6C) Separator key
             // VK_SUBTRACT (6D) Subtract key
-- 
GitLab