Sync animation frame rate to the refresh rate of the menu's display - #71
Sync animation frame rate to the refresh rate of the menu's display#71danielchalmers wants to merge 1 commit into
Conversation
6a94b2e to
c098437
Compare
|
Closing: measurement shows this is a no-op. I instrumented the actual animation tick rate on a 165 Hz display (a WPF already ticks at the display refresh rate without this change. The 30 Hz row confirms The premise behind this PR, that WPF animates at 60 fps by default, is legacy .NET Framework behavior that no longer applies on modern .NET. Not worth ~100 lines and a Also measured along the way: a layered window ( |
Summary
WPF ticks its animation timing engine at roughly 60 fps by default regardless of the monitor's refresh rate, so on high refresh rate displays every animation in the app updates only every 2-3 refresh cycles, which reads as judder. This is most visible on the short interactions: hover (83 ms) and press (67 ms) transitions, drag-to-reorder rotation, and the window fades.
Each time the menu is shown,
MenuServicequeries the refresh rate of the display the cursor is on (the same display both positioning modes open the menu on) and applies it withTimeline.SetDesiredFrameRateto the fade storyboards and, viaPieControl, to every animationPieAnimationServicecreates.Design notes
Timeline.DesiredFrameRatemetadata default. That over-ticked slower monitors in mixed-rate setups and could never react to display hotplug, refresh rate changes, or the menu moving between monitors (metadata overrides are one-shot by design). Re-querying on every show costs one native call and handles all of those cases.WpfUtilalready had for cursor positioning:MONITORINFObecomesMONITORINFOEX(which carries the device name) and oneEnumDisplaySettingsimport plus theDEVMODEstruct is added. The earlier revision's separateDisplayUtilwith adapter enumeration is gone.Verification
main(which now includes Cache the surface ring's drop shadow to cut per-frame GPU cost聽#72).GetCursorMonitorRefreshRateexercised on a dual-monitor setup with the cursor parked on each display in turn, including a secondary monitor at negative coordinates: both resolved to 165 Hz, confirming the device-name lookup works for non-primary displays.