change timer for smoother mouse follow#20396
Conversation
|
Thanks for this attempt to tackle #19987. Unfortunately, panning is still jerky even in this PR, while Windows Magnifier is smooth. I woud not say that it fully closes #19987. Given we can easily see the mouse move, it's quite clear that we have not 125ms refresh period for mouse tracking. Can you indicate, maybe in #19987, if you have explored other ideas? |
|
well it doesn't fix the mouse, only the magnified view refresh rate. I think the mouse issue should be adressed in an other pr. I don't want to had to much code at a time as it seems to slow down the process more than anything |
I think the problem here is that I'm not triggering on event but I'm checking status so it's why it's "laggy", changing the logic to event would probably resolve this, I'm working on it |
Yes, NV Access prefer smaller and well targetted PRs than big ones; as you have noted, this render the process smoother. Performing improvements one at a time is OK. You should just modify the initial description "Closes #19987" since "Close" is a GitHub magic word which will trigger #19987 closing. |
|
The issue #19987 was particularly about a change in smoothness due to setting a higher DPI. Is this PR related to the DPI issue? Could you reproduce that one? |
|
This PR targets the general mouse panning jerkiness (as described in #20060), not the DPI-specific lag in #19987. The root cause here is the Windows timer resolution floor (~15ms), which we address with timeBeginPeriod(1). The DPI-specific issue, where lag is significantly worse at 225% scaling vs 100% on the same display, is a separate investigation that we haven't reproduced or addressed yet. |
Sorry @Boumtchack, you seem to be mixing things here.
|
|
Yes, I've been looking at the dpi one on an other branch that I will share soon I hope, I have a hard time remembering every scope of every issues and their updates. I'm sorry for that I'm doing my best. |
Don't worry, there are a lot of issues and not all are very clearly worded... |
Link to issue number:
Partially addressing #19987
Summary of the issue:
When following the mouse, the NVDA magnifier panned in a jerky, discontinuous way compared to the built-in Windows Magnifier. Users noticed a distinct "pause then jump" instead of smooth real-time panning.
Description of user facing changes:
Mouse panning is now significantly smoother. The magnifier follows the mouse in real time at up to 125 Hz instead of being capped at the system's default timer resolution (~67 Hz).
Description of developer facing changes:
timeBeginPeriod(1) / timeEndPeriod(1) are now called from winmm.dll (via the new winBindings.winmm bindings) when the magnifier starts and stops. The update timer is now a repeating wx.Timer (oneShot=False) rather than a self-rescheduling one-shot timer, removing per-tick object creation overhead. _TIMER_INTERVAL_MS is now 8 ms.
Description of development approach:
The root cause was two-fold: Windows default timer resolution (~15 ms floor) made sub-15 ms intervals ineffective, and the self-rescheduling one-shot pattern added creation overhead at every tick. Setting the timer resolution to 1 ms removes the floor; switching to a repeating timer removes the overhead.
Testing strategy:
updated unit, manual
Known issues with pull request:
Code Review Checklist: