-
-
Notifications
You must be signed in to change notification settings - Fork 629
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
Restartable timers #3702
base: matejcik/global-layout-only3
Are you sure you want to change the base?
Restartable timers #3702
Conversation
TODO: I again forgot to add a changelog (this time for what was #3633 which is an impactful change that could plausibly affect users) |
|
|
be8eb9c
to
6489e27
Compare
How? |
see the changelog:
if I missed a refresh somewhere, someone will see it as bad screen response |
… are gone this juuust might fix unexplained freezes on hardware
This was necessary for hooking display.refresh() with the old UI toolkit. With the new one, we explicitly refresh the display after every paint, so implicit after-step refresh seems no longer necessary.
ba47f68
to
69b724b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
fixes "Queue overflow" error in T2B1 click tests which happens if (a) your CPU is fast enough or (b) you improve performance of UI code too much (also supersedes #3363 which could not be merged due to the speed improvement triggering this problem)
Summary of problem
Every button click in some screens will fire off a new timer event. Previously, there was no way to unschedule those timer events, so if you sent events too fast, there would be too many timers and they would overflow the queue
Summary of solution
A same logical timer will now reuse its event if it is already scheduled.
The performance cost amortizes to zero -- you spend work upfront to unschedule the event, but you save work of processing an already scheduled event which will be ignored in the end.
This means that every button click will schedule the same timer over and over again, saving precious queue space.
Quality of life
Timer
is now a nicer struct member in that the user doesn't need to manually manage theirOption<TimerToken>
, and internally handles starting, stopping, and restarting.Other changes
fixes T2B1: Wrong behavior when auto-mover hits a wall #3692 519dc9fnow that we haveufmt
, I re-didprintln!
macros to work the same way as the real thing, and introduceduformat!
macro that works a lot like the real thing. Use this in your UI code with abandon. d5e6651refactor ofIgnoreButtonDelay
which was needlessly using timers, and also was confusingly mixed into the already confusing state machine of ButtonController 7f5401b(removed unrelated changes, a separate PR will follow)