Repository navigation
fix(win32): drive animations and timers during modal size-move loops (#2908) - #2918
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2908
Root cause
Pressing and holding a Windows window's title bar or resize border enters user32's modal size-move loop (
WM_ENTERSIZEMOVE..WM_EXITSIZEMOVE), where winit'sAboutToWaitandNewEventscallbacks do not run. Continuous animations park inRedraw::Wants, and stepped loops or scheduled timers (such asSpinnerCycle { fps: 60.0 }orTx::wake_after) never wake until the pointer moves or releases.PR #2753 added a modal
WM_TIMERonly forResizeSync::Onafter the first resize step enteredState::Dragging. It did not run betweenWM_ENTERSIZEMOVEand the first size step, during held moves, for stepped/timer-driven loops, or whenResizeSyncwasOff/Auto.Changes
crates/rune/src/platform/win32/dpi_drag.rs):ModalDemand::{Idle, Continuous, At(Instant)},TimerMode::{Continuous, Scheduled},ModalTickState::{Outside, InLoopIdle, InLoopArmed},ModalTickEvent,ModalTickEffect, and purestep_modal_tick(rune::machine).MOVINGvector andResizeSync-onlytick_activeflag with one per-HWNDMODALtable for every subclassed window.WM_TIMERimmediately atWM_ENTERSIZEMOVEwhen needed, invalidates (InvalidateRect(..., 0)) on each tick so winit deliversRedrawRequested, adjusts/disarms on state edges without resetting running timers on rapid resize steps, and kills the timer onIdle,WM_EXITSIZEMOVE, orWM_NCDESTROY.crates/rune/src/window/win32/modal_tick.rs,crates/rune/src/window/host/any_host.rs,crates/rune/src/window/win32/resize_sync.rs):compute_modal_demandandHost::sync_modal_tick, synced at the end ofwindow_event_in_turn,user_event_in_turn,turn_ends_in_turn, andResizeSyncdrag/priming/release transitions.Loader, springs, compositor, pendingRedraw), steppedCycleloops (Spinner) and scheduled timers (poll_deadline,backoff,video_layers), andResizeSyncDComp priming while arming zero timers for idle or non-drawable windows.crates/rune/src/platform/win32/dpi_drag_tests.rs,crates/rune/src/window/win32/modal_tick_tests.rs):ResizeSync::OnandResizeSync::Off, idle vs animating vs steppedSpinner/ caret timers, early-fire recovery, mid-hold background wakes,ResizeSyncpriming and fallback, andWM_EXITSIZEMOVE/WM_NCDESTROYcleanup.Verification
cargo check -p rune --lib(0 warnings in touched files)cargo check -p rune --lib --target wasm32-unknown-unknown(0 warnings)cargo test -p rune --lib dpi_drag(5 passed, 0 failed)cargo test -p rune --lib modal_tick(6 passed, 0 failed)cargo test -p rune --lib resize_sync(32 passed, 0 failed)scripts/file-size.sh(0 errors, 0 folder-shape issues)kit-gallery.