Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-evaluate VKeyboard & autocmd design #186

Open
ColinPitrat opened this issue Mar 26, 2021 · 0 comments
Open

Re-evaluate VKeyboard & autocmd design #186

ColinPitrat opened this issue Mar 26, 2021 · 0 comments
Labels

Comments

@ColinPitrat
Copy link
Owner

Currently the virtual keyboard inject SDL events.

To do this:

  • for regular char, it maps the char (from the button name) to a SDL event (SDLkeysFromChars)
  • for special keys and emulator commands, it uses SDLkeysymFromCPCkeys on a CPC key

The drawback of this design are:

  • it depends on the keyboard layout. We have to test it with all layouts (keymap_*.map) to be sure that it works fine
  • some keys can be problematic (no ideal SDL event corresponding to the CPC_key) whereas the purpose of the virtual keyboard is exactly to provide a workaround for this

It should be possible to map the string to CPC keys and inject them instead. It requires:

  • removing SDLkeysFromChars (it's only used for this) and replacing it by CPCkeysFromChars
  • stop posting a KEYDOWN / KEYUP event and post a USEREVENT instead, or even not post an event and handle the key change (call applyKeyPress) directly. Problem: This doesn't cover emulator specific keys (MOD_EMU_KEY). The keyup/keydown logic processing the cpc_key (applyKeyPress + emulator specific) could be moved into a separate function that would be called both for KEYDOWN, KEYUP and USEREVENT
  • User event code would be either DOWN or UP, data1 would be the cpc_key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant