Repository navigation
Add axRemoveMessages to drop queued events by target and type - #49
Merged
Merged
Conversation
axRemoveFromQueue drops everything queued for a target and cancels its timers, which is right for a destroyed window but too broad for one stale event. axRemoveMessages(target, message, wparam) removes only the events of one type for one target; AX_ANY_WPARAM ((uint32_t)-1) matches any wParam, and a specific value removes, for example, the queued ticks of one cancelled timer. Other events keep their order and the target's timers keep running. The ring-buffer backends (X11, Wayland, Windows, WebGL, QNX) compact the queue. macOS clears matches in place because Cocoa events refer to queue slots by index, and peek already skips cleared slots. iOS shares one matcher with axRemoveFromQueue. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gft4mytn9t9qr1ANVAo2gW
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.
Summary
axRemoveFromQueue(target)drops everything queued for a target and cancels its timers. That's right for a destroyed window, but too broad for removing one stale event. This adds:It removes the queued events of one type for one target.
AX_ANY_WPARAMmatches any wParam; a specific value removes only the events that carry it, for example the already-queued ticks of one cancelled timer. Other events keep their order, and the target's timers keep running.ORCA needs this so that cancelling a timer also drops its already-queued ticks. On macOS a late first tick of a repeating timer could find the next tick already queued, so a handler that cancelled the timer still received a stale tick (corepunch/orca#392).
Per backend:
peek_messagealready skips cleared slots.ios_remove_messagesgains a type and wParam filter (type 0 matches any type), shared withaxRemoveFromQueue.Tests
tests/test_messages.c: removing one timer of one target keeps other timers, targets and types in order;AX_ANY_WPARAMremoves the type whatever its wParam.tests/test_macos_events.m: the same checks on the real NSApp-backed queue.tests/test_ios_message_queue.c: the same checks on the iOS queue.make testlocally with the X11 and the Wayland backend: all green. The macOS, iOS, Windows and WebGL code is compiled and tested only by CI.Generated by Claude Code