1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 18:07:59 +00:00

Handle suspend and resume events in PuTTYgen as well.

[originally from svn r2881]
This commit is contained in:
Ben Harris 2003-02-23 13:31:12 +00:00
parent 8bff62d5b8
commit d563d6e35b
2 changed files with 33 additions and 4 deletions

View File

@ -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 * Copyright (c) 1999, 2003 Ben Harris
* All rights reserved. * All rights reserved.
@ -71,6 +71,7 @@ static void mac_event(EventRecord *);
static void mac_contentclick(WindowPtr, EventRecord *); static void mac_contentclick(WindowPtr, EventRecord *);
static void mac_growwindow(WindowPtr, EventRecord *); static void mac_growwindow(WindowPtr, EventRecord *);
static void mac_activatewindow(WindowPtr, EventRecord *); static void mac_activatewindow(WindowPtr, EventRecord *);
static void mac_suspendresume(EventRecord *);
static void mac_updatewindow(WindowPtr); static void mac_updatewindow(WindowPtr);
static void mac_keypress(EventRecord *); static void mac_keypress(EventRecord *);
static int mac_windowtype(WindowPtr); static int mac_windowtype(WindowPtr);
@ -310,6 +311,13 @@ static void mac_event(EventRecord *event) {
} }
break; break;
#endif #endif
case osEvt:
switch ((event->message & osEvtMessageMask) >> 24) {
case suspendResumeMessage:
mac_suspendresume(event);
break;
}
break;
case kHighLevelEvent: case kHighLevelEvent:
AEProcessAppleEvent(event); /* errors? */ AEProcessAppleEvent(event); /* errors? */
break; 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) { static void mac_zoomwindow(WindowPtr window, short part) {
/* FIXME: do something */ /* FIXME: do something */

View File

@ -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 * Copyright (c) 1999, 2002 Ben Harris
* All rights reserved. * All rights reserved.
@ -58,10 +58,10 @@ resource 'pGen' (0, purgeable) {
resource 'SIZE' (-1) { resource 'SIZE' (-1) {
reserved, reserved,
ignoreSuspendResumeEvents, acceptSuspendResumeEvents,
reserved, reserved,
canBackground, canBackground,
needsActivateOnFGSwitch, doesActivateOnFGSwitch,
backgroundAndForeground, backgroundAndForeground,
dontGetFrontClicks, dontGetFrontClicks,
ignoreAppDiedEvents, ignoreAppDiedEvents,