input-overlay icon indicating copy to clipboard operation
input-overlay copied to clipboard

Mouse and keyboard issues

Open univrsal opened this issue 2 years ago • 7 comments

This issue accumulates all issues with mouse and keyboard buttons/mappings.

#247 Apparently an issue with the preset (fixed in #100)

#266 Side mouse button swapped (These mapping issues might not be really fixable as "swapped" for one person could be the correct order for others and therefore a separate layout with swapped side buttons would probably just be better)

#209 Tilde key not registering on uk qwerty. This was on v4.8 so maybe the new uiohook version already fixed this. #216 Tilde key not working on us qwerty.

#201 ü, ö, ä not working (io-cct probably not returning the correct keycodes

#180 Right mouse button and middle mouse button swapped

#174 Arrow keys issue as well as numpad/function keys (delete, insert etc.) (Related PR for libuiohook)

#187 Tilde, left super/meta/windows key, side mouse buttons

Just like with the gamepad issues, I'll close the individual issues and use this one to track their progress

These issues leave the following keys/buttons to test:

  • Tilde (us and uk qwerty), Left Super/Meta/Windows key,
  • Side mouse buttons (swapped)
  • Middle mouse button and right mouse button swapped

univrsal avatar Dec 06 '22 19:12 univrsal

Gonna add this here but also not expect it to be fixed until after the SDL work: Wayland interacts a bit differently than X does on Linux, and so there may need to be some additional work to explicitly request focus of the keyboard/mouse to get that working under Wayland. While controller input works fine for me, keyboard/mouse doesn't under the existing plugin, and I'd imagine the new work will need some changes as well.

Happy to help test this out and probably figure out what weird code changes are necessary to make it work.

clarfonthey avatar Dec 07 '22 17:12 clarfonthey

Gonna add this here but also not expect it to be fixed until after the SDL work: Wayland interacts a bit differently than X does on Linux, and so there may need to be some additional work to explicitly request focus of the keyboard/mouse to get that working under Wayland. While controller input works fine for me, keyboard/mouse doesn't under the existing plugin, and I'd imagine the new work will need some changes as well.

Happy to help test this out and probably figure out what weird code changes are necessary to make it work.

Input hooking is done through libuiohook, Wayland support is tracked here https://github.com/kwhat/libuiohook/issues/100, but that doesn't really matter as Wayland doesn't really support global input hooking last time I checked.

univrsal avatar Dec 07 '22 18:12 univrsal

Yeah, Wayland doesn't support global input hooks, but I believe that with something like OBS you can kind of hack it in by letting both windows have focus. Either way, I was planning to take a look myself to see what I can do for it since it's not really a standard use case.

clarfonthey avatar Dec 07 '22 20:12 clarfonthey

as Wayland doesn't really support global input hooking

And it won't have it by design. Some features, such as global shortcuts, can only be implemented through portals as a universal method for a sandbox-compatible and safe solution or in specific libraries, i.e. wlroots.

000exploit avatar Feb 05 '23 00:02 000exploit

Probably related to #174 is io-cct returning 0x0 as the keycode for VC_KP_DIVIDE. Manually setting it to the correct value (0x0E35) works in OBS.

Another issue I encountered is that in io-cct the mouse wheel scroll directions are reversed. The description of the element lists them in the correct order (up then down). In OBS they are recognised properly.

Lastly, still regarding the mouse wheel, it appears that there is currently no differentiation between vertical and horizontal scrolling. I only use the mouse wheel element in the preset and haven't set anything up for horizontal scrolling (as I'm not using it in the game). In OBS, scrolling right triggers the visuals for scrolling down and scrolling left the visuals for scrolling up, while in io-cct both are recognised as scrolling down.

Svarr avatar Feb 13 '23 23:02 Svarr

I propose the following for #180:

Add a setting to swap middle mouse and right mouse button.

It would go here, before any logic/dispatching: https://github.com/univrsal/input-overlay/blob/5f394fa84a2b269b2cf0ff11067d7f5a5140c2bd/src/hook/uiohook_helper.hpp#L50

if (event->type == EVENT_MOUSE_CLICKED || event->type == EVENT_MOUSE_PRESSED ||
    event->type == EVENT_MOUSE_RELEASED) {
    if (event->data.mouse.button == 2)
        event->data.mouse.button = 3;
    else if (event->data.mouse.button == 3)
        event->data.mouse.button = 2;
}

Maybe there's a more appropriate place to switch the buttons, like the JavaScript.

e9x avatar Apr 28 '23 22:04 e9x

https://github.com/univrsal/input-overlay/blob/5f394fa84a2b269b2cf0ff11067d7f5a5140c2bd/src/hook/uiohook_helper.hpp#L63-L72

univrsal avatar Apr 28 '23 22:04 univrsal