univrsal / input-overlay

Show keyboard, gamepad and mouse input on stream
GNU General Public License v2.0
2.63k stars 235 forks source link

"Less/greater/backslash" key on ISO 105-key Nordic layout not detected on Linux. #378

Open Kile-Asmussen opened 6 months ago

Kile-Asmussen commented 6 months ago

Platform:

Linux-compatible (NixOS), Firefox

Bug Description:

Input Overlay fails to register presses to the 105th key on Nordic layout 105-key ISO keyboards. (That's the less than/greater than/backslash key located between Right Shift and Z. It is prime keyboard real-estate for gaming.)

IO-CCT on Firefox, claims the keycode is 0xE46 = 3654, which isn't to my knowledge a valid (SDL2) keyboard scancode. In the IO-CCT user interface, this binding does work correctly, but it does not work in OBS.

Having read the SDL2 source code, I have tried manually entering the following code values: 49, 50, 100.

According to the command showkeys which prints scancodes to terminal as they're pressed, (and is otherwise consistent with IO-CCT,) the scancode for this key is 86. Manually entering this value in the JSON configuratiion also does not work.

Reproduction instructions:

On Linux, with Firefox

  1. Have a 105 key nordic keyboard.
  2. Open IO-CCT and create a new keyboard overlay.
  3. Program a key to be the <>\ key located between right shift and Z.
  4. Key overlay should correctly indicate in IO-CCT.
  5. Import overlay into OBS.
  6. Key overlay does not correctly indicate in OBS.

Expected behavior:

Key overlay should work the same in IO-CCT and OBS.

Additional information:

univrsal commented 6 months ago

Input overlay does not use sdl2 for keyboard input, it uses libuiohook. There seem to be two issues here. Firefox reports the key as either "Backslash" or "Comma" when using QWERTY or QWERTZ. It should be reported as "IntlBackslash" which is what Chromium does. The other issue is that the keycode is supposed to be 0x0E46 as per uihook.h, but it's not mapped for linux. I've pushed a fix that defines it for linux, but I can't do much about the issues with firefox as both "Backslash" and "Comma" are incorrect and I don't see a way to distinguish it from the actual backslash and comma keys.

Kile-Asmussen commented 6 months ago

@univrsal Thank you so much for looking into this so quickly. It would seem then that Firefox works exactly the same as Chromium actually, and both of them correctly specifies the <>\ key as 0xE46, no issue there. I just found it intuitively to look like a problem, but it is intended behavior.

When the fix has been released, I'll look into getting it into the Nix package.

univrsal commented 6 months ago

It would seem then that Firefox works exactly the same as Chromium actually, and both of them correctly specifies the <>\ key as 0xE46, no issue there.

That's strange. So if you press the key on this, what does the code column show?

Currently the fix is just pushed to master, do you need a new version to be released for the package?

Kile-Asmussen commented 6 months ago

image

univrsal commented 6 months ago

That looks correct, never mind then.