From 280b9d0adf87388ecb5521626a6e2fc641656688 Mon Sep 17 00:00:00 2001 From: Wolfgang Thaller Date: Sun, 22 Apr 2018 11:21:58 +0200 Subject: [PATCH] Prevent console apps from launching in the background with MultiFinder --- Console/ConsoleWindow.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Console/ConsoleWindow.cc b/Console/ConsoleWindow.cc index 32340be337..017f7d74f3 100644 --- a/Console/ConsoleWindow.cc +++ b/Console/ConsoleWindow.cc @@ -30,6 +30,22 @@ namespace ConsoleWindow::ConsoleWindow(Rect r, ConstStr255Param title) { + { + // give MultiFinder a chance to bring the App to front + // see Technote TB 35 - MultiFinder Miscellanea + // "If your application [...] has the canBackground bit set in the + // size resource, then it should call _EventAvail several times + // (or _WaitNextEvent or _GetNextEvent) before putting up the splash + // screen, or the splash screen will come up behind the frontmost + // layer. If the canBackground bit is set, MultiFinder will not move + // your layer to the front until you call _GetNextEvent, + // _WaitNextEvent, or _EventAvail." + + EventRecord event; + for(int i = 0; i < 5; i++) + EventAvail(everyEvent, &event); + } + GrafPtr port; win = NewWindow(NULL, &r, "\pRetro68 Console", true, 0, (WindowPtr)-1, false, 0);