[Bf-blender-cvs] [b7533f92e5e] master: GHOST: add support for application/menu key

Harley Acheson noreply at git.blender.org
Tue Dec 10 07:14:13 CET 2019


Commit: b7533f92e5e515555951ca00cec0690c7f59d8f4
Author: Harley Acheson
Date:   Tue Dec 10 16:54:47 2019 +1100
Branches: master
https://developer.blender.org/rBb7533f92e5e515555951ca00cec0690c7f59d8f4

GHOST: add support for application/menu key

Support the application key on Linux & Windows.

===================================================================

M	intern/ghost/GHOST_Types.h
M	intern/ghost/intern/GHOST_EventPrinter.cpp
M	intern/ghost/intern/GHOST_SystemSDL.cpp
M	intern/ghost/intern/GHOST_SystemWin32.cpp
M	intern/ghost/intern/GHOST_SystemX11.cpp
M	source/blender/makesrna/intern/rna_wm.c
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/wm_event_types.h

===================================================================

diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 32472373b17..fab315e5f13 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -312,6 +312,7 @@ typedef enum {
   GHOST_kKeyRightAlt,
   GHOST_kKeyOS,      // Command key on Apple, Windows key(s) on Windows
   GHOST_kKeyGrLess,  // German PC only!
+  GHOST_kKeyApp,     /* Also known as menu key. */
 
   GHOST_kKeyCapsLock,
   GHOST_kKeyNumLock,
diff --git a/intern/ghost/intern/GHOST_EventPrinter.cpp b/intern/ghost/intern/GHOST_EventPrinter.cpp
index ba9ed6e3037..119c9f28223 100644
--- a/intern/ghost/intern/GHOST_EventPrinter.cpp
+++ b/intern/ghost/intern/GHOST_EventPrinter.cpp
@@ -234,6 +234,9 @@ void GHOST_EventPrinter::getKeyString(GHOST_TKey key, char str[32]) const
       case GHOST_kKeyOS:
         tstr = "OS";
         break;
+      case GHOST_kKeyApp:
+        tstr = "App";
+        break;
       case GHOST_kKeyGrLess:
         // PC german!
         tstr = "GrLess";
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp
index 06a82db1de5..d3295d5584c 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.cpp
+++ b/intern/ghost/intern/GHOST_SystemSDL.cpp
@@ -234,6 +234,7 @@ static GHOST_TKey convertSDLKey(SDL_Scancode key)
       GXMAP(type, SDL_SCANCODE_RALT, GHOST_kKeyRightAlt);
       GXMAP(type, SDL_SCANCODE_LGUI, GHOST_kKeyOS);
       GXMAP(type, SDL_SCANCODE_RGUI, GHOST_kKeyOS);
+      GXMAP(type, SDL_SCANCODE_APPLICATION, GHOST_kKeyApp);
 
       GXMAP(type, SDL_SCANCODE_INSERT, GHOST_kKeyInsert);
       GXMAP(type, SDL_SCANCODE_DELETE, GHOST_kKeyDelete);
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index c0a4376fd4c..fa2fc9fff37 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -821,6 +821,9 @@ GHOST_TKey GHOST_SystemWin32::convertKey(short vKey, short scanCode, short exten
       case VK_RWIN:
         key = GHOST_kKeyOS;
         break;
+      case VK_APPS:
+        key = GHOST_kKeyApp;
+        break;
       case VK_NUMLOCK:
         key = GHOST_kKeyNumLock;
         break;
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 72c0ad761a4..24a577a18c4 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -1721,6 +1721,7 @@ static GHOST_TKey ghost_key_from_keysym(const KeySym key)
       GXMAP(type, XK_Caps_Lock, GHOST_kKeyCapsLock);
       GXMAP(type, XK_Scroll_Lock, GHOST_kKeyScrollLock);
       GXMAP(type, XK_Num_Lock, GHOST_kKeyNumLock);
+      GXMAP(type, XK_Menu, GHOST_kKeyApp);
 
       /* keypad events */
 
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 8e68495dd78..a57be90b08c 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -242,6 +242,7 @@ const EnumPropertyItem rna_enum_event_type_items[] = {
     {RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Right Shift", "ShiftR"},
     {0, "", 0, NULL, NULL},
     {OSKEY, "OSKEY", 0, "OS Key", "Cmd"},
+    {APPKEY, "APP", 0, "Application", "App"},
     {GRLESSKEY, "GRLESS", 0, "Grless", ""},
     {ESCKEY, "ESC", 0, "Esc", ""},
     {TABKEY, "TAB", 0, "Tab", ""},
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 7c3e4ebc008..f24b7826b01 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -4165,6 +4165,8 @@ static int convert_key(GHOST_TKey key)
         return LEFTALTKEY;
       case GHOST_kKeyRightAlt:
         return RIGHTALTKEY;
+      case GHOST_kKeyApp:
+        return APPKEY;
 
       case GHOST_kKeyCapsLock:
         return CAPSLOCKKEY;
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index 7a25a6dfa4d..e39e6a8698b 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -202,6 +202,8 @@ enum {
   MEDIAFIRST = 0x00b0, /* 176 */
   MEDIALAST = 0x00b1,  /* 177 */
 
+  APPKEY = 0x00b2, /* 178 */
+
   F1KEY = 0x012c,  /* 300 */
   F2KEY = 0x012d,  /* 301 */
   F3KEY = 0x012e,  /* 302 */



More information about the Bf-blender-cvs mailing list