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

Numpad keys behave in unexpected ways #5504

Closed
DorpsGek opened this issue Mar 16, 2013 · 2 comments
Closed

Numpad keys behave in unexpected ways #5504

DorpsGek opened this issue Mar 16, 2013 · 2 comments
Labels
bug Something isn't working component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay stale Stale issues

Comments

@DorpsGek
Copy link
Member

fonsinchen opened the ticket and wrote:

Steps to reproduce, in any game, using the default hotkeys.cfg (with numbers mapped to road building tools):

  1. Open the road building tool bar.
  2. Click "rename" in some station view window.
  3. Make sure the renaming text field is focused.
  4. Type some numbers on the numpad, toggling numlock in between.

Expected results:
The numbers typed with numlock on should appear as numbers in the text field. The numbers typed with numlock off should either be ignored or trigger the actions of the cursor keys associated with the typed number keys.

Observed results:
The numbers typed with numlock on appear correctly. The numbers typed with numlock off trigger the road building tools.

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/5504
@DorpsGek
Copy link
Member Author

frosch wrote:

Attached diff fixes this for SDL. (all other video drivers would need similar treatment)

The idea behind the fix is to stronger distinguish whether a key is meant as hotkey or with its normal semantical meaning.
- Hotkeys are identified via their physical position on the keyboard, i.e. their scancode. Numpad keys are separate keys, their meaning does not change with numlock.
- The semantical meaning of numpad keys changes with numlock. When numlock is enabled, they match the numerical keys. When numlock is disabled, they match the cursor keys.

The patch distinguishes these meanings via 'key' and 'keycode'. 'key' holds the semantical meaning of a key, which are mostly unicode characters, but also special codes for cursor keys, backspace and such. 'keycode' otoh also refers to the scancode.

Editboxes and the console almost exclusively use 'key' now. While 'keycode' is only uses by Hotkeys.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5504#comment12096

@DorpsGek DorpsGek added component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) bug labels Apr 7, 2018
@andythenorth andythenorth added the patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay label Apr 13, 2018
@TrueBrain TrueBrain added bug Something isn't working and removed bug from FlySpray labels Apr 13, 2018
@andythenorth andythenorth added the stale Stale issues label Jan 5, 2019
@andythenorth
Copy link
Contributor

Thanks for this. There's been no activity on this for some time, and as it stands, it doesn't look likely that it will go any further. I'm closing it as we try to keep the issue count low for OpenTTD, it helps us focus on things that are important and fun. Feel free to discuss in irc or request re-opening if you disagree. Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay stale Stale issues
Projects
None yet
Development

No branches or pull requests

3 participants