fix(window): coalesce activation events through classic pending slots - #598
Closed
benletchford wants to merge 1 commit into
Closed
fix(window): coalesce activation events through classic pending slots#598benletchford wants to merge 1 commit into
benletchford wants to merge 1 commit into
Conversation
Owner
Author
|
Superseded by #599, which contains the identical patch and is ready for review with green CI. |
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 #597.
What changed
CurActivateandCurDeactivelow-memory globals as the two replaceable pending activation slots.behind = (WindowPtr)-1even when it is initially invisible, matching classic Window Manager behavior.Root cause
Activation events bypass the classic Operating System event queue, but the HLE accumulated them in an unbounded FIFO. It also skipped activation when a frontmost window was created invisible. A sequence of rapid window changes could therefore deliver a superseded deactivation event after an application had released and reused the target window's refCon storage, causing guest dispatch through stale data.
Impact
Applications that construct several frontmost windows before polling events now observe the latest pending activation/deactivation pair and the documented active state for invisible frontmost windows. Civilization II proceeds through world generation instead of jumping through a stale callback.
Validation
cargo fmt --all -- --checkcargo test pending_activation --libcargo test invisible_frontmost_new_window --lib