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

ui.backend.windows: fix special treatment of the character keypresses #2126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alex-ilin
Copy link
Member

Without this fix, Caps Lock state interferes with the shortcuts like
Ctrl-a by registering them as Ctrl-A, and it is also impossible to create
shortcuts with the Shift key to be triggered only by the physical pressing
of the Shift key, and not the Caps Lock state.

With this fix, all the key-down events for characters have the lower case
letter, and the Shift state reported in the mods field.

This patch solves the issue for the Windows platform, not any others, but the UI shortcut definitions are updated globally, so other platforms will probably lose the functions like A+S+k to clear the stack in the listener.

Without this fix, Caps Lock state interferes with the shortcuts like
Ctrl-a by registering them as Ctrl-A, and it is also impossible to create
shortcuts with the Shift key to be triggered only by the physical pressing
of the Shift key, and not the Caps Lock state.

With this fix, all the key-down events for characters have the lower case
letter, and the Shift state reported in the mods field.
@mrjbq7
Copy link
Member

mrjbq7 commented Apr 1, 2019

Seems a lot less clear to do { S+ } "k" instead of "K"...

So what do you do with like "&"? ... is it now { S+ } "&"?

@timor
Copy link
Contributor

timor commented Apr 1, 2019

Maybe I don't have the whole picture here, but I think there are two issues involved here, which are conceptually separate:

  1. Whether or not caps lock should be treated as shift with regards to key bindings
  2. How to define key bindings for shift+<key> combinations

As for 1., I think that the behavior should be platform-independent, but maybe made modal if some application UI logic requires that behavior. (For example, some computer game might want to use the caps lock key not as a modifier key, but actually handle key-up/key-down events?)

Regarding 2., I personally like the way it is currently defined (as described in the documentation).

@mrjbq7
Copy link
Member

mrjbq7 commented Jun 11, 2019

@erg any thoughts?

@nomennescio
Copy link
Contributor

nomennescio commented Oct 25, 2019

I agree with @timor, but want to add that typically handling keypresses is done at a lower level than getting typed in characters (think e.g. of multiple keypresses to compose unicode character input). Caps lock should not carry state into handling of keypresses, it should operate at the character input level (unless you want all applications to handle it themselves, which is ugly). That means that CAPSLOCK should become a key symbol that can be detected with key-up and key-down gestures. How to encode gestures in Factor should indeed stay independent of these choices. It might be enlightening to have a look at how Emacs solves it cross-platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants