Closed yzy-1 closed 1 month ago
Sounds similar enough to the idle notifier code. That one's refreshed on every input event, but the cursor one could be refreshed on every pointer event instead.
Thanks for the feedback. You're right that it does have similarities with the idle notifier code. However, I believe cursor hiding should occur after a period of inactivity, which means there would be no corresponding pointer event (or even input::State::process_input_event
will not be called) during that time.
I tried to implement this here, but the effect is that the cursor wouldn't hide until an input event occurred (like key press or something), essentially making the timeout ineffective.
I check cursor timeout in function refresh_pointer_outputs
and now it succeeds and works perfectly fine.
OK. I resolved them all.
I did some fixes, and I also had to reimplement the inactivity hiding as a timer after all, since otherwise it would fire late due to refresh()
simply not being called when nothing is happening. Please test that this still works for you; otherwise it's good to merge.
It worked perfectly! Thank you!
Thanks
This pull request addresses the discussion on #284 regarding cursor management in niri. Specifically, I have implemented the second solution: hiding the cursor while typing.
The implementation of cursor timeout (solution 1) would require active polling to check the remaining time, which is not straightforward given our current design where all cursor-related updates are triggered by events. Implementing this approach would involve finding a suitable place in the codebase to handle the periodic checks, which I found challenging due to the existing event-driven architecture.
In contrast, hiding the cursor while typing (solution 2) can be seamlessly integrated as it aligns with the existing event-driven model. This implementation is more straightforward and reduces potential complexity.
Please review the changes and let me know if any further adjustments are needed.