-
Notifications
You must be signed in to change notification settings - Fork 69
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
Keypad Keymap improvement and inclusion of more intuitive key combinations #44
Conversation
denisps
commented
May 2, 2016
- Reimplemented the keymap, mapping all the keys to as intuitive key combinations as I could think of, while also preserving the existing Alt combinations. (Some of the Alt combinations were and still aren't working on windows due to collision with application menu and duplication)
- Reimplemented keypad key look-up to be O(1) instead of O(n)
switch (button) | ||
{ | ||
// Touchpad left buttons | ||
case Qt::Key_Escape: case Qt::Key_Escape | ALT: return esc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alt-Esc was On/Home before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. Fixed. I can't use that combo anyway, as it's a reserved combo, on windows at least.
Redesigning the keypad implementation was overdue and this looks very promising so far! |
Looks nice - I'll try on Mac hopefully very soon :) |
Works really well except for one issue:
Result: "(7)" + ( key stuck Stuck keys are really annoying as the OS behaves quite weird and it persists resets and restarts. |
OK, That's a challenging issue. This is how the keyboard events work. That is what qt gives us, and that is what system gives to qt. I assume you are on Mac, but I'm experiencing the same on windows. I've worked around that problem by releasing last pressed key. Let's assume the user is not going to hold multiple shift modifiable keys simultaneously while releasing the shift. There is also a possibility of user pressing shift while holding a shift modifiable key, and then releasing the key while holding the shift, which almost never happens in the real world usage, so, I think, we can safely ignore this scenario. |
It is indeed a challenging issue and the main reason I kept the initial implementation so simple.
How hard is it to remove that constraint too? Stuck keys are a nuisance. I have an idea how the issue can be solved completely: |
The problem with that is that event->key() gives us virtual keys, modified with shift, ctrl, etc at the time of the event, which is what it gets directly from the system. The press event is being modified by shift, while release event is being delivered directly. We don't know what layout the keyboard has, and so we don't really know what virtual keys map to what physical keys. For instance, Shift+7 is ? on a keyboard with Russian layout. But even if we knew the layout, and were willing to implement it ourselves, nativeScanCode is not working on Mac. |
I see, X11 itself does it the same way, apparently. If we don't even have the guarantee that Qt KeyEvents match up, I can't see any way to implement it :-( |
Yeah, so, works fine on Mac as well, but I may have the same kind of issues you are talking about (tried with the latest change as of this date/time): Hold a key (let's say This only happens with Edit: I actually have this behaviour without these changes, so at least it's not a regression :) |
Solved. Also, I went from switch case to hash since it's true O(1) independent of compiler optimization, looks better, and can potentially be configurable in the settings. |
Sadly the issue still remains:
-> ( stuck. |
I don't seem to have the issue @Vogtinator is describing - everything gets pressed and released as expected when trying the sequence (and some variants) However, the issue with |
int row = key / 11; | ||
int col = key % 11; | ||
|
||
if (state) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an assert for row here, like in qmlbridge.cpp?
As it's highly unlikely to be ever fixed completely, I'll merge this when the two nitpicks are solved. |
Done. I experience neither of those on windows 7, neither with ctrl, nor with alt, nor with shift. |
Thanks! If you want to, you can add yourself in the author list in mainwindow.cpp.
On X11, there's a special "parenleft" key, so the same issue with Qt, just a layer below as well. |
Added. Thanks! |