Larry Clapp: 1
app/internal/window: allow punctuation as keycode events
1 files changed, 1 insertions(+), 1 deletions(-)
> On Sun Nov 17, 2019 at 9:01 PM Larry Clapp wrote:
> > Allows things like Ctrl-{.
> >
> > All punctuation is returned as-is, e.g. "!" is "!", not (on my
> > keyboard) Shift-1, and "{" is "{", not (on my keyboard) Shift-[.
>
> The intention of key.Event.Name is that it contains the unmodified
> key name, usually what is printed on the physical key. So in your
> case, Shift+1 should result in Name = "1", just like pressing 1
> without shift does.
That makes sense for letters, but I don't understand the usefulness
for punctuation, especially given that the output of "shift-1" on one
keyboard may be different from the output of "shift-1" on another.
(Although "shift-2" or "shift-4" seem like better examples of things
that actually vary.)
On QWERTY, ";" is just ";". �On QWERTZ, ";" is "shift-,". �Several
other punctuation symbols are shifted on one keymap and not on
another. �Some of what I consider "regular punctuation" appear to be
only reachable via AltGr on some keymaps, though I'm not sure about
that. (This is all based on a few minutes browsing Wikipedia about
keymaps, so take it with a grain of salt.)
My point is, what will Gio users (and *their* users) want to do? �I,
for one, would rather write code for "@" instead of "shift-2", and I'd
especially like to write code for "<" instead of "shift-,", because on
the German QWERTZ layout, "<" is an unshifted key, and "shift-," is
";"! �I think what you're suggesting would force Gio users to either
re-implement keymaps (probably badly), or ignore them.
I could of course be missing something. :)
> It seems the Goldilocks solution is to drop
> charactersIgnoringModifiers and use keyCode with something like
> UCKeyTranslate to achieve a true charactersIgnoringModifiers.
>
> Do you want to work on that? If not, please file a TODO so we won't
> forget.
I looked at the documentation for UCKeyTranslate and frankly don't
know enough Objective C to get started. If you decide you'd rather
take that route, I'll create a TODO.
It seems to me that even if you do want to take that approach
long-term, possibly using my current patch would be a good
intermediary stop-gap? I think it's better than not being able to
watch for "ctrl-," *at all*, for example. And that way you could get
feedback from folks on whether it's good enough for them, or whether
using UCKeyTranslate would actually do The Right Thing.
-- Larry