Virtual key without corresponding physical key

Hi!

I’m having trouble getting the virtual keys that don’t have a corresponding physical key to work.

This ones in particular:
SDLK_AMPERSAND
SDLK_ASTERISK
SDLK_AT
SDLK_CARET
SDLK_COLON
SDLK_DOLLAR
SDLK_EXCLAIM
SDLK_GREATER
SDLK_HASH
SDLK_LEFTPAREN
SDLK_LESS
SDLK_PERCENT
SDLK_PLUS
SDLK_QUESTION
SDLK_QUOTEDBL
SDLK_RIGHTPAREN
SDLK_UNDERSCORE

Reference

On my Swedish keyboard SDLK_COLON for example should be produced when pressing SDL_SCANCODE_PERIOD while holding SDL_SCANCODE_(L/R)SHIFT but I can’t get SDL to ever return SDLK_COLON. (Or any of the other mentioned.)

I have tried both with US keyboard layout and a proper US keyboard but the result is the same.

Do I need to enable something to get this to work? (Like the old SDL_EnableUNICODE.)

SDL version: SDL2-devel-2.0.10-mingw.tar.gz
OS: Windows 10 (I also have the same issue on Ubuntu 18.04.)

Any help you can give me is appreciated.

Thanks
/aj

I’m not sure SDLK_COLON etc. can ever be returned…?

Looking at the source for Windows I see this:

In function WIN_WindowProc (SDL_windowsevents.c)
666: case WM_KEYDOWN
669: SDL_Scancode code = WindowsScanCodeToSDLScanCode(lParam, wParam);
681: SDL_SendKeyboardKey

I don’t see how you can go from SDL_Scancode to a none physical virtual key in this code. :frowning:

Is this a bug? Otherwise why is the mentioned SDLK_* present in the SDL Keycode Lookup Table?

When you say “returned”, returned how? They won’t be returned in an SDL_KEYDOWN event because that is telling you only about physical keys, but (for example) SDLK_COLON is the regular UTF-8 code for the colon character (0x3A) which will of course be returned in an SDL_TEXTINPUT event. That is exactly what I would expect, but perhaps I’m not understanding your point.