joshgoebel / keyszer

a smart, flexible keymapper for X11 (a fork/reboot of xkeysnail )
Other
69 stars 15 forks source link

(fix) try to ungrab with only a filename #122

Closed joshgoebel closed 1 year ago

joshgoebel commented 1 year ago

Changes

Possible fix for #82.

Checklist

RedBearAK commented 1 year ago

@joshgoebel

Traveling, so I only have a USB mouse wireless dongle to test with, but that does get "grabbed" and it activated the bug of pegging a CPU when removed, so I went ahead and applied the patch and tested.

It appears to work. Basically 0.0 to 0.3% CPU usage after removing the USB mouse dongle, depending on keyboard usage. Normal.

Based on my limited understanding of what the problem was, this appears to be exactly what was needed. A way to remove the device from the registry without tripping over InputDevice() not liking that the device already doesn't exist.

One note, nothing appears in the log when ungrabbing with this new function. Not sure if that was also the case before. Would be nice to see something similar in the log to what it says when grabbing:

(+K) Grabbing Telink Wireless Receiver (/dev/input/event20)
jeffgran-dox commented 1 year ago

Doesn't seem to be working here for me. I am still getting the same behavior as before on this branch. Nothing in the logs. I'd be happy to help test more, I can reliably reproduce this.

joshgoebel commented 1 year ago

It's possible there are two separate issues here and that I've only fixed one... @jeffgran-dox Your issue only starts when unplugging a device?

jeffgran-dox commented 1 year ago

It's possible there are two separate issues here and that I've only fixed one... @jeffgran-dox Your issue only starts when unplugging a device?

Yes, as soon as i unplug my keyboard it starts spiking a cpu core.

joshgoebel commented 1 year ago

Yes, as soon as i unplug my keyboard it starts spiking a cpu core.

Maybe you could start removing try/catch from things until you find an actual error? Otherwise no idea what it could be...

RedBearAK commented 1 year ago

@joshgoebel

I'm back where I have access to a real USB keyboard to test this with. The patch works for me just as it did with the mouse dongle. The keyboard device works fine after being disconnected and reconnected, and there is no spike in CPU activity after disconnecting.

I have no way of explaining why the other user is still experiencing a CPU spike. I would ask them to reinstall keyszer now that this has been merged, and see if they still have the problem.

The logging addition is good. 👍