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

Add handling for suspend and resume events, and set the flags in our 'SIZE'

resource that say we can handle them.  This seems to avoid a crash when PuTTY's
switched away from, and is necessary for Carbon anyway.

[originally from svn r2878]
This commit is contained in:
Ben Harris 2003-02-23 11:58:59 +00:00
parent 01105493cc
commit eec4b9d08d
2 changed files with 33 additions and 4 deletions

View File

@ -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 */

View File

@ -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,