-
Notifications
You must be signed in to change notification settings - Fork 14
hhpc does not reset timer on mouse events #5
Copy link
Copy link
Open
Description
I actually am succesfully working around the issue at the moment, and so far it is okay; but I thought it might help if I present the information to you:
- I modified your program to be a 'one-shot' program, where it grabs and hides the mouse, and when the mouse is active again (i.e. moved), it unhides the mouse and actually exits altogether.
- I created a small wrapper script in python that creates two threads, one thread (an
interruptthread) that activates only on mouse events, and sends an interrupt request signal to the other thread, which is thetimerthread. The signal is simply a boolean variable that tells thetimerthread to reset the timer. - If the timer counts down successfully, a process is opened that externally calls your modified one-shot version of
hhpc, and then instantly hides the mouse. While your program is running, the python script is blocking any further acitivity on its end. Once the mouse is moved, your program of course, quits. After this the script is unblocked the timer is again reset and the process repeats. - Events are read from
/input/devviaxevbindings in a python module. The script is daemonized as asystemdservice to remove the need for any manual calls toroot.
I didn't bother with profiling, but a quick examination of top showed me that the cpu usage ranged from 0-0.3% CPU usage. It was at 0 of course mainly when the mouse was hidden and/or grabbed by your program. Obviously this is not the most ideal solution, as it requires a wrapper script on top of your executable, and removal of almost half of your code (but it works). I just gave you this hoping it might help you find a more direct solution, and to suggest that (maybe) threading would be a good way to approach this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels