From 130c617a9a8a752106735c7524f0363b7d5c44eb Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Thu, 3 Dec 2026 14:06:03 -0500 Subject: [PATCH 01/11] Capture which window calls bring activate events --- ReferenceTests/Retro68/ActivateEventCapture.c | 196 ++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 ReferenceTests/Retro68/ActivateEventCapture.c diff --git a/ReferenceTests/Retro68/ActivateEventCapture.c b/ReferenceTests/Retro68/ActivateEventCapture.c new file mode 100644 index 0000000..e409224 --- /dev/null +++ b/ReferenceTests/Retro68/ActivateEventCapture.c @@ -0,0 +1,196 @@ +/* + * Captures which Window Manager calls bring activate, update and OS events, in + * what order, and what each call leaves the windows' hilited fields. It has the + * SIZE flags of BBEdit Lite 6.1, and starts with the calls BBEdit makes to show + * its first window. + * + * It writes "ActivateEvents.txt" in its own folder, and refuses to run if that + * is already there. Each step is a line naming the calls, with the front window + * and each window's hilited as they were straight after them, then a line for + * each event that GetNextEvent returned in the half second after. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static short out; +static WindowPtr a, b; + +static void line(const char *text) +{ + long count = strlen(text); + FSWrite(out, &count, text); + count = 1; + FSWrite(out, &count, "\r"); + FlushVol(0, 0); +} + +static const char *name(long window) +{ + if (window == 0) return "none"; + if (window == (long)a) return "A"; + if (window == (long)b) return "B"; + return "other"; +} + +static void state(const char *step) +{ + char text[200]; + sprintf(text, "%s: front %s, A %d, B %d", step, name((long)FrontWindow()), + a ? ((WindowPeek)a)->hilited != 0 : -1, b ? ((WindowPeek)b)->hilited != 0 : -1); + line(text); +} + +static void report(const EventRecord *event) +{ + char text[200]; + switch (event->what) { + case activateEvt: + sprintf(text, " activate %s %s", name(event->message), event->modifiers & activeFlag ? "on" : "off"); + break; + case updateEvt: + sprintf(text, " update %s", name(event->message)); + BeginUpdate((WindowPtr)event->message); + EndUpdate((WindowPtr)event->message); + break; + case osEvt: + sprintf(text, " os %08lx", (unsigned long)event->message); + break; + case kHighLevelEvent: + sprintf(text, " high level"); + break; + default: + sprintf(text, " what %d", event->what); + } + line(text); +} + +static void drain(void) +{ + EventRecord event; + long until = TickCount() + 30; + while (TickCount() < until) { + SystemTask(); + if (GetNextEvent(everyEvent, &event) && event.what != nullEvent) + report(&event); + } +} + +static void step(const char *what) +{ + state(what); + drain(); +} + +static WindowPtr make(short left, Boolean visible) +{ + Rect bounds; + SetRect(&bounds, left, 80, left + 200, 220); + return NewWindow(0, &bounds, "\pwindow", visible, 8 /* zoomDocProc */, (WindowPtr)-1L, true, 0); +} + +int main(void) +{ + static const unsigned char file[] = { 18, 'A','c','t','i','v','a','t','e','E','v','e','n','t','s','.','t','x','t' }; + short ref; + EventRecord event; + char text[200]; + + if (FSOpen(file, 0, &ref) == noErr) { FSClose(ref); return 1; } + if (Create(file, 0, 'Grph', 'TEXT') != noErr) return 2; + if (FSOpen(file, 0, &out) != noErr) return 3; + + InitGraf(&qd.thePort); + InitFonts(); + InitWindows(); + InitMenus(); + TEInit(); + InitDialogs(0); + InitCursor(); + + /* As BBEdit shows its untitled window, before it has asked for any event. */ + a = make(20, false); + state("NewWindow A invisible"); + SendBehind(a, 0); + state("SendBehind A nil"); + HiliteWindow(a, false); + state("HiliteWindow A false"); + ShowHide(a, true); + step("ShowHide A true"); + step("nothing more"); + + b = make(260, false); + step("NewWindow B invisible in front"); + ShowWindow(b); + step("ShowWindow B"); + SelectWindow(a); + step("SelectWindow A"); + SelectWindow(a); + step("SelectWindow A again"); + HiliteWindow(a, false); + step("HiliteWindow A false"); + HiliteWindow(a, true); + step("HiliteWindow A true"); + HideWindow(a); + step("HideWindow A, in front"); + ShowWindow(a); + step("ShowWindow A"); + ShowHide(a, false); + step("ShowHide A false"); + ShowHide(a, true); + step("ShowHide A true"); + SendBehind(a, 0); + step("SendBehind A nil"); + BringToFront(a); + step("BringToFront A"); + SelectWindow(b); + SelectWindow(a); + step("SelectWindow B, SelectWindow A"); + + /* What a mask without activMask leaves. */ + SelectWindow(b); + state("SelectWindow B"); + if (GetNextEvent(updateMask, &event)) report(&event); + line(" (after GetNextEvent updateMask)"); + drain(); + + DisposeWindow(b); + b = 0; + step("DisposeWindow B, in front"); + DisposeWindow(a); + a = 0; + step("DisposeWindow A, the last"); + + a = make(20, true); + step("NewWindow A visible, alone"); + DisposeWindow(a); + a = make(20, false); + drain(); + ShowWindow(a); + step("ShowWindow A, alone"); + HideWindow(a); + step("HideWindow A, alone"); + SelectWindow(a); + step("SelectWindow A, hidden"); + ShowHide(a, true); + step("ShowHide A true, alone"); + SelectWindow(a); + step("SelectWindow A, in front already"); + DisposeWindow(a); + a = 0; + drain(); + + sprintf(text, "done"); + line(text); + FSClose(out); + FlushVol(0, 0); + return 0; +} From c61883b87a915a793d3c0908927bde0f80a14267 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Thu, 3 Dec 2026 14:06:03 -0500 Subject: [PATCH 02/11] Give the activate event capture BBEdit's SIZE flags --- ReferenceTests/Retro68/ActivateEventCapture.r | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 ReferenceTests/Retro68/ActivateEventCapture.r diff --git a/ReferenceTests/Retro68/ActivateEventCapture.r b/ReferenceTests/Retro68/ActivateEventCapture.r new file mode 100644 index 0000000..22beb00 --- /dev/null +++ b/ReferenceTests/Retro68/ActivateEventCapture.r @@ -0,0 +1,24 @@ +/* ActivateEventCapture's SIZE: the flags BBEdit Lite 6.1 has that decide which + events it gets, replacing the Retro68 template's. */ +#include "Processes.r" + +resource 'SIZE' (-1) { + reserved, + acceptSuspendResumeEvents, + reserved, + canBackground, + doesActivateOnFGSwitch, + backgroundAndForeground, + dontGetFrontClicks, + ignoreChildDiedEvents, + is32BitCompatible, + isHighLevelEventAware, + localAndRemoteHLEvents, + notStationeryAware, + dontUseTextEditServices, + reserved, + reserved, + reserved, + 1024 * 1024, + 1024 * 1024 +}; From 64d2da1347704ce8f69df259decb7c41296f8c0d Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Thu, 3 Dec 2026 14:06:03 -0500 Subject: [PATCH 03/11] Add the activate events Mac OS 9.2.2 gave --- ReferenceTests/Retro68/ActivateEvents-macos-9.2.2-ppc.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 ReferenceTests/Retro68/ActivateEvents-macos-9.2.2-ppc.txt diff --git a/ReferenceTests/Retro68/ActivateEvents-macos-9.2.2-ppc.txt b/ReferenceTests/Retro68/ActivateEvents-macos-9.2.2-ppc.txt new file mode 100644 index 0000000..a307094 --- /dev/null +++ b/ReferenceTests/Retro68/ActivateEvents-macos-9.2.2-ppc.txt @@ -0,0 +1 @@ +NewWindow A invisible: front none, A 0, B -1 SendBehind A nil: front none, A 0, B -1 HiliteWindow A false: front none, A 0, B -1 ShowHide A true: front A, A 0, B -1 high level update A nothing more: front A, A 1, B -1 NewWindow B invisible in front: front A, A 1, B 0 ShowWindow B: front B, A 0, B 1 activate A off activate B on update B SelectWindow A: front A, A 1, B 0 activate B off activate A on SelectWindow A again: front A, A 1, B 0 HiliteWindow A false: front A, A 0, B 0 HiliteWindow A true: front A, A 1, B 0 HideWindow A, in front: front B, A 0, B 1 activate A off activate B on ShowWindow A: front B, A 0, B 1 update A ShowHide A false: front B, A 0, B 1 ShowHide A true: front B, A 0, B 1 update A SendBehind A nil: front B, A 0, B 1 BringToFront A: front A, A 0, B 1 SelectWindow B, SelectWindow A: front A, A 1, B 0 activate A off activate A on SelectWindow B: front B, A 0, B 1 (after GetNextEvent updateMask) activate A off activate B on DisposeWindow B, in front: front A, A 1, B -1 activate A on DisposeWindow A, the last: front none, A -1, B -1 NewWindow A visible, alone: front A, A 1, B -1 activate A on update A ShowWindow A, alone: front A, A 1, B -1 activate A on update A HideWindow A, alone: front none, A 0, B -1 activate A off SelectWindow A, hidden: front none, A 1, B -1 activate A on ShowHide A true, alone: front A, A 1, B -1 update A SelectWindow A, in front already: front A, A 1, B -1 done \ No newline at end of file From d2016aec081979cfed0fe5317528acf06d4b3a4b Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Thu, 3 Dec 2026 14:06:03 -0500 Subject: [PATCH 04/11] Capture a first window shown from the event loop --- ReferenceTests/Retro68/FirstWindowCapture.c | 150 ++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 ReferenceTests/Retro68/FirstWindowCapture.c diff --git a/ReferenceTests/Retro68/FirstWindowCapture.c b/ReferenceTests/Retro68/FirstWindowCapture.c new file mode 100644 index 0000000..c0fa48b --- /dev/null +++ b/ReferenceTests/Retro68/FirstWindowCapture.c @@ -0,0 +1,150 @@ +/* + * Captures how the first window of a program that has already been through its + * event loop becomes the active one, shown as BBEdit Lite 6.1 shows its own: + * made invisible, sent behind nil, unhilited and shown with ShowHide. It has the + * same SIZE flags as ActivateEventCapture. + * + * It writes "FirstWindow.txt" in its own folder, and refuses to run if that is + * already there. Lines are as ActivateEventCapture's; a "later" line is the + * state half a second further on, with no Window Manager call in between. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static short out; +static WindowPtr a, b; + +static void line(const char *text) +{ + long count = strlen(text); + FSWrite(out, &count, text); + count = 1; + FSWrite(out, &count, "\r"); + FlushVol(0, 0); +} + +static const char *name(long window) +{ + if (window == 0) return "none"; + if (window == (long)a) return "A"; + if (window == (long)b) return "B"; + return "other"; +} + +static void state(const char *step) +{ + char text[200]; + sprintf(text, "%s: front %s, A %d, B %d", step, name((long)FrontWindow()), + a ? ((WindowPeek)a)->hilited != 0 : -1, b ? ((WindowPeek)b)->hilited != 0 : -1); + line(text); +} + +static void report(const EventRecord *event) +{ + char text[200]; + switch (event->what) { + case activateEvt: + sprintf(text, " activate %s %s", name(event->message), event->modifiers & activeFlag ? "on" : "off"); + break; + case updateEvt: + sprintf(text, " update %s", name(event->message)); + BeginUpdate((WindowPtr)event->message); + EndUpdate((WindowPtr)event->message); + break; + case osEvt: + sprintf(text, " os %08lx", (unsigned long)event->message); + break; + case kHighLevelEvent: + sprintf(text, " high level"); + break; + default: + sprintf(text, " what %d", event->what); + } + line(text); +} + +static void drain(void) +{ + EventRecord event; + long until = TickCount() + 30; + while (TickCount() < until) { + if (WaitNextEvent(everyEvent, &event, 1, 0) && event.what != nullEvent) + report(&event); + } +} + +static void step(const char *what) +{ + state(what); + drain(); +} + +static WindowPtr make(short left, Boolean visible) +{ + Rect bounds; + SetRect(&bounds, left, 80, left + 200, 220); + return NewWindow(0, &bounds, "\pwindow", visible, 8 /* zoomDocProc */, (WindowPtr)-1L, true, 0); +} + +static void bbedit(const char *what) +{ + a = make(20, false); + SendBehind(a, 0); + HiliteWindow(a, false); + ShowHide(a, true); + step(what); + step("later"); +} + +int main(void) +{ + static const unsigned char file[] = { 15, 'F','i','r','s','t','W','i','n','d','o','w','.','t','x','t' }; + short ref; + + if (FSOpen(file, 0, &ref) == noErr) { FSClose(ref); return 1; } + if (Create(file, 0, 'Grph', 'TEXT') != noErr) return 2; + if (FSOpen(file, 0, &out) != noErr) return 3; + + InitGraf(&qd.thePort); + InitFonts(); + InitWindows(); + InitMenus(); + TEInit(); + InitDialogs(0); + InitCursor(); + + step("events before any window"); + step("more events"); + + bbedit("ShowHide A true"); + HiliteWindow(a, false); + step("HiliteWindow A false, in front"); + step("later"); + SelectWindow(a); + step("SelectWindow A, in front, not hilited"); + HiliteWindow(a, false); + SelectWindow(a); + step("HiliteWindow A false, SelectWindow A"); + DisposeWindow(a); + a = 0; + drain(); + + bbedit("ShowHide A true again, after a window has gone"); + DisposeWindow(a); + a = 0; + drain(); + + line("done"); + FSClose(out); + FlushVol(0, 0); + return 0; +} From 938783f0f8a9bf297e5768bf452d76e67e98d253 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Thu, 3 Dec 2026 14:06:04 -0500 Subject: [PATCH 05/11] Give the first window capture BBEdit's SIZE flags --- ReferenceTests/Retro68/FirstWindowCapture.r | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 ReferenceTests/Retro68/FirstWindowCapture.r diff --git a/ReferenceTests/Retro68/FirstWindowCapture.r b/ReferenceTests/Retro68/FirstWindowCapture.r new file mode 100644 index 0000000..82c5dda --- /dev/null +++ b/ReferenceTests/Retro68/FirstWindowCapture.r @@ -0,0 +1,24 @@ +/* FirstWindowCapture's SIZE: the flags BBEdit Lite 6.1 has that decide which + events it gets, replacing the Retro68 template's. */ +#include "Processes.r" + +resource 'SIZE' (-1) { + reserved, + acceptSuspendResumeEvents, + reserved, + canBackground, + doesActivateOnFGSwitch, + backgroundAndForeground, + dontGetFrontClicks, + ignoreChildDiedEvents, + is32BitCompatible, + isHighLevelEventAware, + localAndRemoteHLEvents, + notStationeryAware, + dontUseTextEditServices, + reserved, + reserved, + reserved, + 1024 * 1024, + 1024 * 1024 +}; From 5196929a90eb1b7a071393d1d42b7856c2d4f260 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Thu, 3 Dec 2026 14:06:04 -0500 Subject: [PATCH 06/11] Add the first window capture's output --- ReferenceTests/Retro68/FirstWindow-macos-9.2.2-ppc.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 ReferenceTests/Retro68/FirstWindow-macos-9.2.2-ppc.txt diff --git a/ReferenceTests/Retro68/FirstWindow-macos-9.2.2-ppc.txt b/ReferenceTests/Retro68/FirstWindow-macos-9.2.2-ppc.txt new file mode 100644 index 0000000..963876c --- /dev/null +++ b/ReferenceTests/Retro68/FirstWindow-macos-9.2.2-ppc.txt @@ -0,0 +1 @@ +events before any window: front none, A -1, B -1 high level more events: front none, A -1, B -1 ShowHide A true: front A, A 0, B -1 update A later: front A, A 0, B -1 HiliteWindow A false, in front: front A, A 0, B -1 later: front A, A 0, B -1 SelectWindow A, in front, not hilited: front A, A 1, B -1 activate A on HiliteWindow A false, SelectWindow A: front A, A 1, B -1 activate A on ShowHide A true again, after a window has gone: front A, A 0, B -1 update A later: front A, A 0, B -1 done \ No newline at end of file From 2d25edfa479fc23c56ad1b4644bf7d655979718e Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Thu, 3 Dec 2026 14:06:04 -0500 Subject: [PATCH 07/11] Capture BBEdit's calls as it shows its first window --- .../Retro68/LaunchSequenceCapture.c | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 ReferenceTests/Retro68/LaunchSequenceCapture.c diff --git a/ReferenceTests/Retro68/LaunchSequenceCapture.c b/ReferenceTests/Retro68/LaunchSequenceCapture.c new file mode 100644 index 0000000..b660a56 --- /dev/null +++ b/ReferenceTests/Retro68/LaunchSequenceCapture.c @@ -0,0 +1,143 @@ +/* + * Captures what BBEdit Lite 6.1 gets when it shows its untitled window as it + * starts: the event calls it makes before it, with their masks and sleep, then + * the window made invisible, sent behind nil, unhilited, shown with ShowHide, + * and GetNextEvent(activMask) straight after. It has the same SIZE flags as + * ActivateEventCapture. + * + * It writes "LaunchSequence.txt" in its own folder, and refuses to run if that + * is already there. Lines are as FirstWindowCapture's. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static short out; +static WindowPtr a, b; + +static void line(const char *text) +{ + long count = strlen(text); + FSWrite(out, &count, text); + count = 1; + FSWrite(out, &count, "\r"); + FlushVol(0, 0); +} + +static const char *name(long window) +{ + if (window == 0) return "none"; + if (window == (long)a) return "A"; + if (window == (long)b) return "B"; + return "other"; +} + +static void state(const char *step) +{ + char text[200]; + sprintf(text, "%s: front %s, A %d, B %d", step, name((long)FrontWindow()), + a ? ((WindowPeek)a)->hilited != 0 : -1, b ? ((WindowPeek)b)->hilited != 0 : -1); + line(text); +} + +static void report(const EventRecord *event) +{ + char text[200]; + switch (event->what) { + case activateEvt: + sprintf(text, " activate %s %s", name(event->message), event->modifiers & activeFlag ? "on" : "off"); + break; + case updateEvt: + sprintf(text, " update %s", name(event->message)); + BeginUpdate((WindowPtr)event->message); + EndUpdate((WindowPtr)event->message); + break; + case osEvt: + sprintf(text, " os %08lx", (unsigned long)event->message); + break; + case kHighLevelEvent: + sprintf(text, " high level"); + break; + default: + sprintf(text, " what %d", event->what); + } + line(text); +} + +static void drain(void) +{ + EventRecord event; + long until = TickCount() + 30; + while (TickCount() < until) { + if (WaitNextEvent(everyEvent, &event, 1, 0) && event.what != nullEvent) + report(&event); + } +} + +static void step(const char *what) +{ + state(what); + drain(); +} + +static WindowPtr make(short left, Boolean visible) +{ + Rect bounds; + SetRect(&bounds, left, 80, left + 200, 220); + return NewWindow(0, &bounds, "\pwindow", visible, 8 /* zoomDocProc */, (WindowPtr)-1L, true, 0); +} + +int main(void) +{ + static const unsigned char file[] = { 18, 'L','a','u','n','c','h','S','e','q','u','e','n','c','e','.','t','x','t' }; + short ref; + EventRecord event; + EventRecord launch; + long until; + + if (FSOpen(file, 0, &ref) == noErr) { FSClose(ref); return 1; } + if (Create(file, 0, 'Grph', 'TEXT') != noErr) return 2; + if (FSOpen(file, 0, &out) != noErr) return 3; + + InitGraf(&qd.thePort); + InitFonts(); + InitWindows(); + InitMenus(); + TEInit(); + InitDialogs(0); + InitCursor(); + + OSEventAvail(everyEvent, &event); + OSEventAvail(keyDownMask | autoKeyMask, &event); + if (WaitNextEvent((short)0xFFC1, &launch, 15, 0)) { line("WaitNextEvent before the window:"); report(&launch); } + else line("WaitNextEvent before the window: nothing"); + OSEventAvail(everyEvent, &event); + OSEventAvail(keyDownMask | autoKeyMask, &event); + /* BBEdit takes a while here, reading resources, without giving up time. */ + until = TickCount() + 60; + while (TickCount() < until) {} + + a = make(20, false); + SendBehind(a, 0); + HiliteWindow(a, false); + ShowHide(a, true); + state("ShowHide A true"); + if (GetNextEvent(activMask, &event)) report(&event); + else line(" GetNextEvent(activMask): nothing"); + state("GetNextEvent activMask"); + step("event loop"); + step("later"); + + line("done"); + FSClose(out); + FlushVol(0, 0); + return 0; +} From 84bd0e8a5eceeea1f6b248a4550ece72e6c01f4c Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Thu, 3 Dec 2026 14:06:04 -0500 Subject: [PATCH 08/11] Give the launch sequence capture BBEdit's SIZE flags --- .../Retro68/LaunchSequenceCapture.r | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 ReferenceTests/Retro68/LaunchSequenceCapture.r diff --git a/ReferenceTests/Retro68/LaunchSequenceCapture.r b/ReferenceTests/Retro68/LaunchSequenceCapture.r new file mode 100644 index 0000000..b81ba4d --- /dev/null +++ b/ReferenceTests/Retro68/LaunchSequenceCapture.r @@ -0,0 +1,24 @@ +/* LaunchSequenceCapture's SIZE: the flags BBEdit Lite 6.1 has that decide which + events it gets, replacing the Retro68 template's. */ +#include "Processes.r" + +resource 'SIZE' (-1) { + reserved, + acceptSuspendResumeEvents, + reserved, + canBackground, + doesActivateOnFGSwitch, + backgroundAndForeground, + dontGetFrontClicks, + ignoreChildDiedEvents, + is32BitCompatible, + isHighLevelEventAware, + localAndRemoteHLEvents, + notStationeryAware, + dontUseTextEditServices, + reserved, + reserved, + reserved, + 1024 * 1024, + 1024 * 1024 +}; From 11bfa94bc7522567d834b7416a5b41df37931844 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Thu, 3 Dec 2026 14:06:04 -0500 Subject: [PATCH 09/11] Add the launch sequence capture's output --- ReferenceTests/Retro68/LaunchSequence-macos-9.2.2-ppc.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 ReferenceTests/Retro68/LaunchSequence-macos-9.2.2-ppc.txt diff --git a/ReferenceTests/Retro68/LaunchSequence-macos-9.2.2-ppc.txt b/ReferenceTests/Retro68/LaunchSequence-macos-9.2.2-ppc.txt new file mode 100644 index 0000000..c697995 --- /dev/null +++ b/ReferenceTests/Retro68/LaunchSequence-macos-9.2.2-ppc.txt @@ -0,0 +1 @@ +WaitNextEvent before the window: nothing ShowHide A true: front A, A 0, B -1 GetNextEvent(activMask): nothing GetNextEvent activMask: front A, A 0, B -1 event loop: front A, A 0, B -1 high level update A later: front A, A 0, B -1 done \ No newline at end of file From f9b5711b2f7ed6e799f5cb4de9e3e51087a7a397 Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Thu, 3 Dec 2026 14:06:04 -0500 Subject: [PATCH 10/11] Build the activate event captures --- ReferenceTests/Retro68/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ReferenceTests/Retro68/CMakeLists.txt b/ReferenceTests/Retro68/CMakeLists.txt index 8242a3c..ecd4d8f 100644 --- a/ReferenceTests/Retro68/CMakeLists.txt +++ b/ReferenceTests/Retro68/CMakeLists.txt @@ -31,3 +31,6 @@ add_application(ControlRecordCapture ControlRecordCapture.c) add_application(ObjectSpecifierCapture ObjectSpecifierCapture.c) target_link_libraries(ObjectSpecifierCapture ObjectSupportLib) add_application(WindowFrameCapture WindowFrameCapture.c) +add_application(ActivateEventCapture ActivateEventCapture.c ActivateEventCapture.r) +add_application(FirstWindowCapture FirstWindowCapture.c FirstWindowCapture.r) +add_application(LaunchSequenceCapture LaunchSequenceCapture.c LaunchSequenceCapture.r) From e953589f035db6f0a41da2517331e35a376df44f Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Thu, 3 Dec 2026 14:06:04 -0500 Subject: [PATCH 11/11] Document the activate event captures --- ReferenceTests/Retro68/README.md | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/ReferenceTests/Retro68/README.md b/ReferenceTests/Retro68/README.md index a97c7af..c15f397 100644 --- a/ReferenceTests/Retro68/README.md +++ b/ReferenceTests/Retro68/README.md @@ -927,3 +927,43 @@ output is `ControlRecord-macos-9.2.2-ppc.txt` (CR line endings). `GuestControlRecord` is the record's bytes, and `GuestControlRecordTests` replays the offsets, the values and the rectangles. Parts and drawing are not replayed. + +## Activate events + +Three probes show which Window Manager calls bring activate events. Each has +BBEdit Lite 6.1's SIZE flags for the events it gets, ran from the Finder on Mac +OS 9.2.2 in UTM, and writes a line per step with the front window and each +window's hilited, then a line per event. Their outputs (CR line endings) are +`ActivateEvents-`, `FirstWindow-` and `LaunchSequence-macos-9.2.2-ppc.txt`. + +`ActivateEventCapture.c` makes and orders two windows: + +- `ShowWindow` or `NewWindow` of a new front window, `SelectWindow`, + `HideWindow` of the front window and `DisposeWindow` of it brought activate + events: the window going inactive first, then the one becoming active, both + before update events. A disposed window got none. +- `ShowHide`, `HiliteWindow`, `SendBehind` of a window already behind and + `BringToFront` brought none, and neither did `SelectWindow` of the highlighted + front window. +- A window selected and deselected between two event calls was told nothing. +- `GetNextEvent` with `updateMask` left the activate events waiting. +- `SelectWindow` of a hidden window, with no other shown, highlighted it and + brought its activate event. +- A window shown with `ShowHide` before the program's first event call was + highlighted once the program asked for events, with no activate event. + +`FirstWindowCapture.c` shows a window as BBEdit shows its untitled one +(invisible, `SendBehind` nil, `HiliteWindow` false, `ShowHide` true) after the +program has been in its event loop: + +- It stayed unhighlighted, with only an update event. +- `SelectWindow` of the front window, unhighlighted, brought its activate event. + +`LaunchSequenceCapture.c` makes the event calls BBEdit makes before that +window, with their masks and sleep, and `GetNextEvent` with `activMask` after +it, as BBEdit does. There was no activate event, and the window stayed +unhighlighted. BBEdit's window is active on the same system, so something of +BBEdit's launch is not reproduced here. + +Graphite has no event queue, so nothing here replays these: swift-pef's +`GuestActivateEventTests` follows them.