From 525435a1e16ec2892ba0c4a2153505091e4d703a Mon Sep 17 00:00:00 2001 From: ben Date: Sun, 23 Feb 2003 13:31:12 +0000 Subject: [PATCH] Handle suspend and resume events in PuTTYgen as well. git-svn-id: svn://svn.tartarus.org/sgt/putty@2881 cda61777-01e9-0310-a592-d414129be87e --- mac/macpgen.c | 31 ++++++++++++++++++++++++++++++- mac/macpgen.r | 6 +++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/mac/macpgen.c b/mac/macpgen.c index 40827d2d..486a4e93 100644 --- a/mac/macpgen.c +++ b/mac/macpgen.c @@ -1,4 +1,4 @@ -/* $Id: macpgen.c,v 1.4 2003/02/20 22:55:09 ben Exp $ */ +/* $Id: macpgen.c,v 1.5 2003/02/23 13:31:12 ben Exp $ */ /* * Copyright (c) 1999, 2003 Ben Harris * All rights reserved. @@ -71,6 +71,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_updatewindow(WindowPtr); static void mac_keypress(EventRecord *); static int mac_windowtype(WindowPtr); @@ -310,6 +311,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; @@ -438,6 +446,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/macpgen.r b/mac/macpgen.r index 7bc8c294..1c47330d 100644 --- a/mac/macpgen.r +++ b/mac/macpgen.r @@ -1,4 +1,4 @@ -/* $Id: macpgen.r,v 1.4 2003/02/20 22:55:09 ben Exp $ */ +/* $Id: macpgen.r,v 1.5 2003/02/23 13:31:12 ben Exp $ */ /* * Copyright (c) 1999, 2002 Ben Harris * All rights reserved. @@ -58,10 +58,10 @@ resource 'pGen' (0, purgeable) { resource 'SIZE' (-1) { reserved, - ignoreSuspendResumeEvents, + acceptSuspendResumeEvents, reserved, canBackground, - needsActivateOnFGSwitch, + doesActivateOnFGSwitch, backgroundAndForeground, dontGetFrontClicks, ignoreAppDiedEvents, -- 2.11.0