Fix T48369: Missing suport for main '+' key.
authorBastien Montagne <montagne29@wanadoo.fr>
Tue, 10 May 2016 06:22:40 +0000 (08:22 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Tue, 10 May 2016 06:29:03 +0000 (08:29 +0200)
Many keyboard layouts (italian, spanish, german...) have direct access to '+' key on main
keyboard area (not the numpad one), ans x11 has own define for this key, so use it instead
of generating an unkown key event.

Note that we most likely have much more missing 'specific' keycodes for non-US keyboard layout,
but think since we already had a 'minus' keyevent, supporting 'plus' one is totally consistent.
And we had a spare space in our defined values just for it even!

This keyevent is only supported/generated by x11 and cocoa Ghost backends for now,
neither SDL nor win32 seem to have matching key events...

intern/ghost/GHOST_Types.h
intern/ghost/intern/GHOST_SystemCocoa.mm
intern/ghost/intern/GHOST_SystemX11.cpp
source/blender/makesrna/intern/rna_wm.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_playanim.c
source/blender/windowmanager/wm_event_types.h
source/gameengine/GameLogic/SCA_IInputDevice.h
source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp

index 29508a8373390a2593d1ff3d4d544cbfc425ab05..b3e560ab4b456a481e1935dcf4866e46bd765724 100644 (file)
@@ -249,6 +249,7 @@ typedef enum {
        GHOST_kKeyQuote  = 0x27,
        GHOST_kKeyComma  = ',',
        GHOST_kKeyMinus  = '-',
+       GHOST_kKeyPlus   = '+',
        GHOST_kKeyPeriod = '.',
        GHOST_kKeySlash  = '/',
 
index 4db945d31f709fd826a84afde9f4f061542f0e84..bf44d938a47e11245909a0a8177a12c252834328 100644 (file)
@@ -240,6 +240,7 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
 
                                switch (recvChar) {
                                        case '-':       return GHOST_kKeyMinus;
+                                       case '+':       return GHOST_kKeyPlus;
                                        case '=':       return GHOST_kKeyEqual;
                                        case ',':       return GHOST_kKeyComma;
                                        case '.':       return GHOST_kKeyPeriod;
index 0c87ee17cb03e43b36318ac5f531c57400e50ba6..dde63badb910feaff6d714150c872ead4eb8c6c8 100644 (file)
@@ -1500,6 +1500,7 @@ convertXKey(KeySym key)
                        GXMAP(type, XK_quoteright,   GHOST_kKeyQuote);
                        GXMAP(type, XK_quoteleft,    GHOST_kKeyAccentGrave);
                        GXMAP(type, XK_minus,        GHOST_kKeyMinus);
+                       GXMAP(type, XK_plus,         GHOST_kKeyPlus);
                        GXMAP(type, XK_slash,        GHOST_kKeySlash);
                        GXMAP(type, XK_backslash,    GHOST_kKeyBackslash);
                        GXMAP(type, XK_equal,        GHOST_kKeyEqual);
index 51c410e44e1f0d25dd2c9d648bfbf889c734c066..0d11414c878a94cb7f22b55e835e2af6740a1387 100644 (file)
@@ -263,6 +263,7 @@ EnumPropertyItem rna_enum_event_type_items[] = {
        {QUOTEKEY, "QUOTE", 0, "\"", ""},
        {ACCENTGRAVEKEY, "ACCENT_GRAVE", 0, "`", ""},
        {MINUSKEY, "MINUS", 0, "-", ""},
+       {PLUSKEY, "PLUS", 0, "+", ""},
        {SLASHKEY, "SLASH", 0, "/", ""},
        {BACKSLASHKEY, "BACK_SLASH", 0, "\\", ""},
        {EQUALKEY, "EQUAL", 0, "=", ""},
index ad8c31a32f35177a7f191e2a4b13a759db9b6673..40b6f90f6f39f48768c958a09b7951e28ea84605 100644 (file)
@@ -2897,6 +2897,7 @@ static int convert_key(GHOST_TKey key)
                        case GHOST_kKeyQuote:           return QUOTEKEY;
                        case GHOST_kKeyComma:           return COMMAKEY;
                        case GHOST_kKeyMinus:           return MINUSKEY;
+                       case GHOST_kKeyPlus:            return PLUSKEY;
                        case GHOST_kKeyPeriod:          return PERIODKEY;
                        case GHOST_kKeySlash:           return SLASHKEY;
 
index 675958cf0a3731cf36e616aa2c6de6c7b7ee8df5..6bf7bcc29342c7097cafee7110a7b17fa92badd0 100644 (file)
@@ -897,6 +897,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
                                        }
                                        break;
                                case GHOST_kKeyEqual:
+                               case GHOST_kKeyPlus:
                                case GHOST_kKeyNumpadPlus:
                                {
                                        if (val == 0) break;
index c32ded28126d308a8a95b0966edf921b3b1c938a..449612bc5fda4218c596841a61558759b44c7e26 100644 (file)
@@ -167,6 +167,7 @@ enum {
        QUOTEKEY        = 0x00e4,  /* 228 */
        ACCENTGRAVEKEY  = 0x00e5,  /* 229 */
        MINUSKEY        = 0x00e6,  /* 230 */
+       PLUSKEY         = 0x00e7,  /* 231 */
        SLASHKEY        = 0x00e8,  /* 232 */
        BACKSLASHKEY    = 0x00e9,  /* 233 */
        EQUALKEY        = 0x00ea,  /* 234 */
index d4cd66fb564dd2789ded1a24f6f6be739f93f78e..f306ae4f26bb961508a8a641a41f44d55f7f0304 100644 (file)
@@ -129,6 +129,7 @@ public:
                KX_COMMAKEY = 44,
                KX_MINUSKEY = 45,
                KX_PERIODKEY = 46,
+               KX_PLUSKEY = 47,
                KX_ZEROKEY = 48,
                
                KX_ONEKEY,              // =49
index 53d03c6f479dac7158e0f22cd85777bb412ac938..eefaa3730cf6c748c3fcbb329deb2cd8c942b071 100644 (file)
@@ -141,6 +141,7 @@ GPG_KeyboardDevice::GPG_KeyboardDevice(void)
        m_reverseKeyTranslateTable[GHOST_kKeyQuote                 ] = KX_QUOTEKEY                 ;
        m_reverseKeyTranslateTable[GHOST_kKeyAccentGrave           ] = KX_ACCENTGRAVEKEY           ;
        m_reverseKeyTranslateTable[GHOST_kKeyMinus                 ] = KX_MINUSKEY                 ;
+       m_reverseKeyTranslateTable[GHOST_kKeyPlus                  ] = KX_PLUSKEY                  ;
        m_reverseKeyTranslateTable[GHOST_kKeySlash                 ] = KX_SLASHKEY                 ;
        m_reverseKeyTranslateTable[GHOST_kKeyBackslash             ] = KX_BACKSLASHKEY             ;
        m_reverseKeyTranslateTable[GHOST_kKeyEqual                 ] = KX_EQUALKEY                 ;