Fix T48369: Missing suport for main '+' key.

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...
This commit is contained in:
Bastien Montagne 2016-05-10 08:22:40 +02:00
parent 76481eaeff
commit ce65fae8f3
Notes: blender-bot 2023-02-14 19:45:25 +01:00
Referenced by commit 031715f743, Fix missing piece in recent rBce65fae8f32c (support for '+' key).
Referenced by issue #48369, Error PADPLUSKEY [ latin1 ]
Referenced by issue #46414, User Preferences, Input, german keyboard layout, = versus +
9 changed files with 9 additions and 0 deletions

View File

@ -249,6 +249,7 @@ typedef enum {
GHOST_kKeyQuote = 0x27,
GHOST_kKeyComma = ',',
GHOST_kKeyMinus = '-',
GHOST_kKeyPlus = '+',
GHOST_kKeyPeriod = '.',
GHOST_kKeySlash = '/',

View 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;

View 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);

View 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, "=", ""},

View 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;

View 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;

View 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 */

View File

@ -129,6 +129,7 @@ public:
KX_COMMAKEY = 44,
KX_MINUSKEY = 45,
KX_PERIODKEY = 46,
KX_PLUSKEY = 47,
KX_ZEROKEY = 48,
KX_ONEKEY, // =49

View 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 ;