libsdl-org / SDL-1.2

Simple Directmedia Layer, 1.2 branch ... ***DEPRECATED***, please use https://github.com/libsdl-org/SDL for new projects!
https://libsdl.org
GNU Lesser General Public License v2.1
98 stars 81 forks source link

[WINCE] Hardware keys are unmapped. #850

Closed carlo-bramini closed 2 years ago

carlo-bramini commented 2 years ago

Windows Mobile allows to use up to six hardware keys that can be mapped to various functions or used directly by applications:

https://docs.microsoft.com/en-us/previous-versions/bb431750(v=msdn.10)?redirectedfrom=MSDN

When you press/release these hardware keys, Windows returns a virtual scancode from VK_APP1 to VK_APP6, but they are unhandled by SDL1 at the moment.

Those virtual keys have values from 0xC1 to 0xC6 and, on traditional Windows, those scancodes are unssigned:

https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

It is not difficult to fix this issue, but the problem is that I have not found suitable "SDLK_" virtual keys to be used for them.

At the moment, in my local source tree, I mapped VK_APP1 to VK_APP6 to return SDLK_F1 to SDLK_F6, but I doubt that this could be accepted into official tree.

Have you some suggestions for fixing this thing?

Adding some SDLK_APP1 to SDLKAPP6 would be good? Or importing some virtual codes from SDL2? Or using other existing "SDLK" macros? Other solutions?

Thank you.

sezero commented 2 years ago

Missed this for quite some time as it seems.

I am not sure addition of new SDLK_??? keys would be acceptable. We might fill in the gaps in SDLKey enum list with those keys (e.g. between SDLK_DELETE and SDLK_WORLD_0 maybe??) guarded by _WIN32_WCE -- that would be another method of adding new SDLK_??? keys but at least SDLK_LAST won't change.

In any case, I am not sure what would be acceptable. @slouken?

slouken commented 2 years ago

For now mapping to F1-F6 is fine.

sezero commented 2 years ago

@carlo-bramini: send patches (or pull-requests)