diff --git a/mac/mac.c b/mac/mac.c index 1ff3a87f..d8b9b2fa 100644 --- a/mac/mac.c +++ b/mac/mac.c @@ -1,4 +1,4 @@ -/* $Id: mac.c,v 1.50 2003/02/20 22:31:52 ben Exp $ */ +/* $Id: mac.c,v 1.51 2003/02/23 11:58:59 ben Exp $ */ /* * Copyright (c) 1999, 2003 Ben Harris * All rights reserved. @@ -76,6 +76,7 @@ static void mac_event(EventRecord *); static void mac_contentclick(WindowPtr, EventRecord *); static void mac_growwindow(WindowPtr, EventRecord *); static void mac_activatewindow(WindowPtr, EventRecord *); +static void mac_suspendresume(EventRecord *); static void mac_activateabout(WindowPtr, EventRecord *); static void mac_updatewindow(WindowPtr); static void mac_updatelicence(WindowPtr); @@ -323,6 +324,13 @@ static void mac_event(EventRecord *event) { } break; #endif + case osEvt: + switch ((event->message & osEvtMessageMask) >> 24) { + case suspendResumeMessage: + mac_suspendresume(event); + break; + } + break; case kHighLevelEvent: AEProcessAppleEvent(event); /* errors? */ break; @@ -467,6 +475,27 @@ static void mac_closewindow(WindowPtr window) { } } +static void mac_suspendresume(EventRecord *event) +{ + WindowPtr front; + EventRecord fakeevent; + + /* + * We're called either before we're suspended or after we're + * resumed, so we're the front application at this point. + */ + front = FrontWindow(); + if (front != NULL) { + fakeevent.what = activateEvt; + fakeevent.message = (UInt32)front; + fakeevent.when = event->when; + fakeevent.where = event->where; + fakeevent.modifiers = + (event->message & resumeFlag) ? activeFlag : 0; + mac_activatewindow(front, &fakeevent); + } +} + static void mac_zoomwindow(WindowPtr window, short part) { /* FIXME: do something */ diff --git a/mac/mac_res.r b/mac/mac_res.r index cdb21437..965b7153 100644 --- a/mac/mac_res.r +++ b/mac/mac_res.r @@ -1,4 +1,4 @@ -/* $Id: mac_res.r,v 1.27 2003/02/12 23:53:15 ben Exp $ */ +/* $Id: mac_res.r,v 1.28 2003/02/23 11:58:59 ben Exp $ */ /* * Copyright (c) 1999, 2002 Ben Harris * All rights reserved. @@ -57,10 +57,10 @@ resource 'pTTY' (0, purgeable) { resource 'SIZE' (-1) { reserved, - ignoreSuspendResumeEvents, + acceptSuspendResumeEvents, reserved, canBackground, - needsActivateOnFGSwitch, + doesActivateOnFGSwitch, backgroundAndForeground, dontGetFrontClicks, ignoreAppDiedEvents,