InteractiveViz.jl icon indicating copy to clipboard operation
InteractiveViz.jl copied to clipboard

Key bindings don't work as expected on non-English keyboard

Open Suavesito-Olimpiada opened this issue 2 years ago • 4 comments

Basically, what the title says. I use a latam keyboard (Mexican Spanish is my native language) and the keys end up being mapped as follows

Original latam
-/+ '/¿
[/] ´/+
</> ñ/{
,/' ;/.
↑/↓/←/→ ↑/↓/←/→
0 0

Edit: It looks like it is not affected by Mayus modifier.

Suavesito-Olimpiada avatar May 18 '22 16:05 Suavesito-Olimpiada

I don't have a Mexican Spanish keyboard to test on. Do you know what needs to be done to fix this?

mchitre avatar May 18 '22 20:05 mchitre

I don't really know, but, can you point me where are the key bindings defined? Please, that way I might get an idea if is something from Makie, or from here.

(Edit: manners and rationale.)

Suavesito-Olimpiada avatar May 18 '22 21:05 Suavesito-Olimpiada

I think I found the issue, and it's in core.jl.

Makie uses GLFW for windows of GLMakie, in GLFW documentation states that

GLFW divides keyboard input into two categories; key events and character events. Key events relate to actual physical keyboard keys, whereas character events relate to the Unicode code points generated by pressing some of them.

GLMakie abstract the use of this through Events, where you can access both of them. The event.key used here correspond to the hardware key number, but the property events(c.parent.scene).unicode_input[] correspond to the key pressed (or released) taking into account the keyboard layout.

events(c.parent.scene).unicode_input[] is simply a Char, and can be compared as that, so it would be easy to fix this. I'm working on a PR right now. :)

Suavesito-Olimpiada avatar May 19 '22 06:05 Suavesito-Olimpiada

Sounds good. Look forward to the PR.

mchitre avatar May 20 '22 07:05 mchitre

No longer relevant, as the keybindings are now handled by GLMakie directly.

mchitre avatar May 16 '23 16:05 mchitre