-
-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve responsiveness of input and focus by pumping immediately instead of after a delay. #14928
Conversation
Touch exploration in input help lasts a great deal longer now. However, after between 10 and 30 seconds, or much sooner if you add a second finger, eventually it still ends up producing:
The OS already floods our message queue with touch messages. It has probably always been on the edge. I think we should add an attribute to scripts that say if they are immediate or not, setting hover's to false. And then honoring this attribute all places in executeGesture, and in queueScript. |
This feels like the wrong solution to me and I'm not sure it will fix it completely. We should now only be adding two extra window messages to the queue per tick: one for touch to request a delayed pump and one for the (immediate) script. Furthermore, we should be processing all of the messages each tick, so there shouldn't be a backlog like this. Does touch exploration for more than 10 seconds even work in current alphas? |
If we do want to go down the path you suggest, I wonder whether it'd be easier to just catch OSError 1816 and change it to a delayed pump if that occurs. |
The other thing worth noting is that currently, requesting a pump uses a window message even for a delayed pump requested on the main thread. I did that for simplicity, but I could avoid that message for delayed pumps by reinstating the main thread check and just starting the timer inline in that case. |
@jcsteh @michaelDCurran Considering the obstacles, do you think this PR will be part of NVDA 2023.2? |
I've done this now, though I haven't tested it with touch yet. It feels kinda hacky, but I don't have a better solution and I think the gain outweighs the hackiness. I've underscore prefixed the attribute so it's clear it's private and not part of the public API, so we can remove it without breaking the API if we come up with a better solution. In future, I think we should consider making touchHandler or touchTracker limit these hover actions itself; e.g. by using a timeout like we do for other touch tracker stuff. I think that should be handled separately though, as there are more unknowns there. |
I've tested with touch and everything seems to work as expected. I updated the PR description accordingly. |
…ead of after a delay.
… custom window message rather than wx.CallAfter.
…nchronously rather than queuing that. If the message queue is full when requesting an immediate pump from the main thread, downgrade it to a delayed pump.
…ouch problem and the extra complexity isn't worth it otherwise.
I'm still seeing an OSError in the capter func when doing a multi-finger hover for several seconds. I.e. ts:2finger_hold+hover. |
56c4171
to
a10fe0b
Compare
Thanks. I was able to reproduce that and have fixed it now. Sorry, I misunderstood how to test the two finger thing; I was adding a second finger while hovering, but not for long enough to trigger the problem. Much easier just to put two fingers on the screen and wait. |
Asdflksjdflkj. Nope, now seeing OSErrors when hovering for a while. |
See test results for failed build of commit 6b6dcb4fc6 |
Okay. Hopefully this is really, really fixed this time. |
Link to issue number:
None.
Summary of the issue:
Currently, everything in NVDA, including responding to keyboard input and focus changes, goes through the core pump. The core pump is always run with a slight delay. Assuming nothing else is already queued, any input or focus change will not be processed for a minimum of 10 ms. In reality, it's potentially longer due to the system timer resolution and the fact that timers are low priority messages. We should be aiming for the fastest possible response to user input and focus changes.
Description of user facing changes
NVDA will respond slightly faster to commands and focus changes.
Description of development approach
_immediate
argument which is passed to requestPump. It is_
prefixed to mitigate conflicts with keyword arguments intended for queued functions._immediate
attribute to False to prevent immediate pumps. This is set on all touch hover gestures to avoid exhausting the window message queue, since hover gestures are queued every pump if there is an active hover.Testing strategy:
I used "time since input" logging to measure the differences in times before and after the change in various situations:
This can be quite variable, so it's only a rough guide, but the results are pretty suggestive.
I also verified that touch hovering works as expected even when my finger remains in contact with the screen for 30 seconds. I tested that turning on input help and holding down two fingers for 10 seconds doesn't break input help.
Known issues with pull request:
None.
Change log entries:
Bug fixes
NVDA now responds slightly faster to commands and focus changes.
Code Review Checklist: