-
Notifications
You must be signed in to change notification settings - Fork 9k
Extend lead/trail edge support for throttled_func #19210
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
Conversation
| toolTipInterval, | ||
| til::throttled_func_options{ | ||
| .delay = std::chrono::milliseconds{ hoverTimeoutMillis }, | ||
| .debounce = true, |
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.
Try jiggling your cursor over the minimize/maximize buttons and the popup will flicker. By setting debounce=true here this is also fixed.
| co_await winrt::resume_background(); | ||
|
|
||
| CompletionsChanged.raise(*this, *args); | ||
| CompletionsChanged.raise(*this, winrt::make<CompletionsChangedEventArgs>(winrt::hstring{ menuJson }, replaceLength)); |
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.
Oh right, this is a drive by change. I did it initially when I considered going a different route with this and I can back it out.
The reason I kept this is because this is the only function which yields to a background thread before invoking the callback. We shouldn't do that to keep it consistent (no surprises).
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.
fine with me
|
|
||
| if (execute) | ||
| { | ||
| _execute(std::move(args), schedule); |
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.
doesn't this move from args twice, once on R106 and once on R115, if the function is both leading and trailing?
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.
No, because the condition for executing here is !timerRunning && _leading which is the same condition as above that precludes it from being moved.
| const auto toolTipInterval = std::chrono::milliseconds(hoverTimeoutMillis); | ||
| if (FAILED(SystemParametersInfoW(SPI_GETMOUSEHOVERTIME, 0, &hoverTimeoutMillis, 0))) | ||
| { | ||
| hoverTimeoutMillis = 400; |
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.
does SystemParametersInfoW destroy the value on failure? bah!
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.
I don't know that, but I don't believe that we should rely on the assumption that it doesn't. I doubt that this was tested in some way too (after all, can this call even fail?).
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.
After reviewing the kernel code, I found that the call can never fail.
| co_await winrt::resume_background(); | ||
|
|
||
| CompletionsChanged.raise(*this, *args); | ||
| CompletionsChanged.raise(*this, winrt::make<CompletionsChangedEventArgs>(winrt::hstring{ menuJson }, replaceLength)); |
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.
fine with me
You can now create throttled functions which trigger both on the leading and trailing edge. This was then also ported to `ThrottledFunc` for `DispatcherQueue`s and used for title/taskbar updates. Closes #19188 * In CMD run: ```batch FOR /L %N IN () DO @echo %time% ``` * Doesn't hang the UI ✅ SERVICE NOTES This replays part of #19192 to make it compatible with throttled_func. (cherry picked from commit dbf740c) Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgdI2TQ PVTI_lADOAF3p4s4AxadtzgdSMv0 Service-Version: 1.23
You can now create throttled functions which trigger both on the leading
and trailing edge. This was then also ported to
ThrottledFuncforDispatcherQueues and used for title/taskbar updates.Closes #19188
Validation Steps Performed