htrefil / rkvm

Virtual KVM switch for Linux machines
MIT License
395 stars 50 forks source link

Release keys pressed when switching clients #16

Closed Szpadel closed 1 year ago

Szpadel commented 3 years ago

Currently when you switch client while having multiple keys set as combo, it will keep those keys pressed until you press them again. This is causing issues in many situations.

This patch causes server to send release event to all currently pressed keys from combo when client is changed.

PS: I removed TODO commend as I imagine it is about this exact issue

evan-goode commented 3 years ago

Nice, I was trying to fix some similar with https://github.com/htrefil/rkvm/pull/14/. Maybe we should not only release all the keys in the combo on the old client, but also press all the keys on the new client? I just pushed https://github.com/evan-goode/rkvm/commit/e7c08a49160004dbe0f8761fae9fddfcfbb0ceb7 which does that, borrowing some of your code. The use case for this is as follows:

  1. Say you have switch bound to Super + A
  2. Hold Super, then hit A to switch from client 0 to client 1
  3. Currently, only the A keydown would be sent to client 1, but it would be nice if client 1 also got a Super keydown so you could proceed to do other Super+key shortcuts on client 1 without re-pressing Super.
Szpadel commented 3 years ago

Imo repressing key on next client isn't desired in most cases, if your combo contains only modifier keys, it might be fine, but any other key could cause undesired behavior.

htrefil commented 1 year ago

Fixed in 0.3.0. Thank you for your MR though.