Skip to content

Deliver launch and other Apple events as Classic high-level events - #47

Merged
colemancda merged 11 commits into
masterfrom
feature/launch-events
Dec 1, 2026
Merged

colemancda merged 11 commits into
masterfrom
feature/launch-events

Conversation

@colemancda

Copy link
Copy Markdown
Member

Continues section 4 of the BlueBox requirements. Apple events now reach a Classic program as high-level events through EventAvail, GetNextEvent and WaitNextEvent, and AEProcessAppleEvent hands them to the guest-handler delivery from #46. The queue behaviour is checked against Mac OS 9.2.2.

Mac OS 9.2.2 capture

ReferenceTests/Retro68/HighLevelEventCapture.c, with a SIZE resource that makes it aware of high-level events, ran under UTM. It sends events to its own PSN so that they go through its queue. Its output is HighLevelEvents-macos-9.2.2-ppc.txt.

  • Launch event: oapp arrives as kind 23, with the class in message and the ID in where (high half in v).
  • FlushEvents: it neither removes a high-level event nor stops at one, even with highLevelEventMask as the stop mask.
  • Order: a low-level event posted after two high-level events is returned before both.
  • AEProcessAppleEvent: with two events retrieved and unprocessed, it delivers the second and the first is gone.
  • Errors: a dropped record, a kind 12 record, or the same record again gives noOutstandingHLE (-608).

Changes

  • ClassicEventQueue: high-level events stay apart from the low-level queue. They are retrieved in order only when no low-level event matches, and FlushEvents skips them. Tagged posting (post(_:tag:), contains(tag:)) lets a poster tell whether an event was retrieved.
  • AppleEventInbox (new, GraphiteAutomation): queues Apple events as high-level EventRecords.
    • postLaunch queues oapp; with documents odoc; for printing pdoc then quit.
    • take/process implement AEProcessAppleEvent as captured, starting a delivery with beginDelivery.
  • MacError.noOutstandingHighLevelEvent (-608).
  • Package: GraphiteAutomation now depends on GraphiteEvents.

For reviewers

  • The old EventTests.classicHighLevelEventMask expected FlushEvents to stop at a high-level event. That part moved into classicHighLevelEventsStayApart, which follows the capture.
  • Event masks were already right: each kind below 16 is its own bit, kind 23 is 0x0400, and kinds 16–22 match nothing.
  • Not covered by the capture:
    • pdoc followed by quit follows Apple's Finder documentation; the probe only saw oapp.
    • Kinds 16–22 are held back like high-level events, but only kind 23 was compared with app1.

Tests

AppleEventInboxTests and EventTests.classicHighLevelEventsStayApart are new. The full suite passes.

@colemancda
colemancda merged commit 29b5907 into master Dec 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant