cloudhead / rx

👾 Modern and minimalist pixel editor
https://discord.gg/xHggPjfsS9
GNU General Public License v3.0
3.1k stars 109 forks source link

Non-Qwerty keyboards broken with current defaults #18

Closed g2p closed 5 years ago

g2p commented 5 years ago

I figured out that I need to enable the winit feature to get proper key mappings on my non-qwerty keyboard. Maybe this should be documented, or enabled by default.

cloudhead commented 5 years ago

Do the default key bindings usually work for you in other software? Can you give an example of what's not working and what layout are you using? Thanks.

g2p commented 5 years ago

I'm using azerty. Almost all software works by default, everything follows the keyboard layout, which is great except for the occasional game that uses a hard-coded, non-remappable WASD. Here's a map for perspective.

g2p commented 5 years ago

The first thing I tried was to enter command mode, I got zoom-in instead, and had to grep the source to find what was going on.

cloudhead commented 5 years ago

Hmmm, there's two ways to solve this that I can think of, but none are ideal:

  1. Support specific layouts out of the box, eg. qwerty, qwertz and azerty, and have the user set the layout they want to use.
  2. Change the way inputs are processed, however this might mean that you can't have hold/release behaviors on keys other than shift/ctrl/alt. So you can't have for eg. "hold e to switch to erase mode".
g2p commented 5 years ago

Could you start by blessing winit over glfw? Having two divergent ways of handling key bindings is bound to break expectations. I haven't had any trouble once I enabled the winit feature, and if it starts behaving strangely grepping for accesses to the scancode field would make it very easy to pinpoint the issue. Also, by keeping interactions close to vim, I don't think you will be required to do anything that doesn't localize.

cloudhead commented 5 years ago

Could you start by blessing winit over glfw

Unfortunately not - winit has significant problems on macOS. I’m not sure actually why the two handle keys differently - potentially there might be a way to have winit’s behavior in glfw. I’m looking into that now.

cloudhead commented 5 years ago

I pushed a change to master that should fix this with glfw. Do you want to give it a try? You won't be able to map all keys on the azerty layout, but it should work for all keys accessible without 'shift' on the qwerty layout.

g2p commented 5 years ago

I tried it, it works fine. Thank you!