Changeset View
Standalone View
intern/ghost/intern/GHOST_SystemWin32.cpp
| Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | |||||
| # define VK_SEMICOLON 0xBA | # define VK_SEMICOLON 0xBA | ||||
| #endif // VK_SEMICOLON | #endif // VK_SEMICOLON | ||||
| #ifndef VK_PERIOD | #ifndef VK_PERIOD | ||||
| # define VK_PERIOD 0xBE | # define VK_PERIOD 0xBE | ||||
| #endif // VK_PERIOD | #endif // VK_PERIOD | ||||
| #ifndef VK_COMMA | #ifndef VK_COMMA | ||||
| # define VK_COMMA 0xBC | # define VK_COMMA 0xBC | ||||
| #endif // VK_COMMA | #endif // VK_COMMA | ||||
| #ifndef VK_QUOTE | |||||
| # define VK_QUOTE 0xDE | |||||
| #endif // VK_QUOTE | |||||
| #ifndef VK_BACK_QUOTE | #ifndef VK_BACK_QUOTE | ||||
| # define VK_BACK_QUOTE 0xC0 | # define VK_BACK_QUOTE 0xC0 | ||||
| #endif // VK_BACK_QUOTE | #endif // VK_BACK_QUOTE | ||||
| #ifndef VK_SLASH | #ifndef VK_SLASH | ||||
| # define VK_SLASH 0xBF | # define VK_SLASH 0xBF | ||||
| #endif // VK_SLASH | #endif // VK_SLASH | ||||
| #ifndef VK_BACK_SLASH | #ifndef VK_BACK_SLASH | ||||
| # define VK_BACK_SLASH 0xDC | # define VK_BACK_SLASH 0xDC | ||||
| ▲ Show 20 Lines • Show All 705 Lines • ▼ Show 20 Lines | switch (vKey) { | ||||
| key = GHOST_kKeyLeftBracket; | key = GHOST_kKeyLeftBracket; | ||||
| break; | break; | ||||
| case VK_BACK_SLASH: | case VK_BACK_SLASH: | ||||
| key = GHOST_kKeyBackslash; | key = GHOST_kKeyBackslash; | ||||
| break; | break; | ||||
| case VK_CLOSE_BRACKET: | case VK_CLOSE_BRACKET: | ||||
| key = GHOST_kKeyRightBracket; | key = GHOST_kKeyRightBracket; | ||||
| break; | break; | ||||
| case VK_QUOTE: | case VK_OEM_7: | ||||
brecht: It was not obvious to me, but apparently `VK_QUOTE == VK_OEM_7`, so the actual functional… | |||||
mano-wiiAuthorUnsubmitted Done Inline ActionsOh yes, I forgot to explain that. VK_QUOTE does not exist in windows API (WinUser.h) and also does not necessarily represent the symbol of "Quote". As seen in https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes, the name given to the value 0xDE is VK_OEM_7 and can represent different symbols depending on the layout used. Basically what this code does is: If the "virtual-key code" is VK_OEM_7 but the key position is the equivalent position of the {key } key on the US keyboard, then Blender will read it as the {key } otherwise it will read as ". Maybe we could just check the scanCode for some keys and forget about the layout used. But as there are so many layouts I preferred a less drastic change. Remembering that ` is not really the symbol that appears on the keyboard of these layouts, but for greater compatibility and ergonomy, it might be better to use this symbol and forget that ² and < could exist in events e keymaps. mano-wii: Oh yes, I forgot to explain that.
`VK_QUOTE` does not exist in windows API (`WinUser.h`) and… | |||||
| /* It can vary by keyboard. */ | |||||
| if (scanCode == 0x29) { | |||||
| key = GHOST_kKeyAccentGrave; | |||||
| } | |||||
| else { | |||||
| key = GHOST_kKeyQuote; | key = GHOST_kKeyQuote; | ||||
| } | |||||
| break; | break; | ||||
| case VK_GR_LESS: | case VK_GR_LESS: | ||||
| key = GHOST_kKeyGrLess; | key = GHOST_kKeyGrLess; | ||||
| break; | break; | ||||
| case VK_SHIFT: | case VK_SHIFT: | ||||
| /* Check single shift presses */ | /* Check single shift presses */ | ||||
| if (scanCode == 0x36) { | if (scanCode == 0x36) { | ||||
| ▲ Show 20 Lines • Show All 1,452 Lines • Show Last 20 Lines | |||||
It was not obvious to me, but apparently VK_QUOTE == VK_OEM_7, so the actual functional change is checking the scan code.