diff --git a/sys/suspend/Makefile b/sys/suspend/Makefile new file mode 100644 index 0000000..1a8b581 --- /dev/null +++ b/sys/suspend/Makefile @@ -0,0 +1,4 @@ +suspda: suspda.c + cmpl suspda.c keep=suspda + chtyp -t \$B8 suspda + cp suspda /procyon/system/desk.accs diff --git a/sys/suspend/suspda.c b/sys/suspend/suspda.c new file mode 100644 index 0000000..b0f01ec --- /dev/null +++ b/sys/suspend/suspda.c @@ -0,0 +1,81 @@ +#pragma nda daOpen daClose daAction daInit 0xFFFF 0 " Suspend...\\H***\xBDZ" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#pragma databank 1 +void stophandle(int sig, int code) +{ +byte *bf = (byte *) 0xE100FFl; +byte old; +struct sgttyb sb; +MouseRec oldmr; +ClampRec cl1,cl2; +unsigned int button; + + /* Save off some important information */ + GrafOff(); + gtty(1,&sb); + sb.sg_flags &= ~RAW; + stty(1,&sb); + + oldmr = ReadMouse(); + cl1 = GetAbsClamp(); + cl2 = GetMouseClamp(); + + old = *bf; + *bf = 0; + kill(getpid(),SIGSTOP); + *bf = old; + + /* Get things set back up for the desktop application again */ + SetMouse(oldmr.mouseMode); + SetAbsClamp(cl1); + ClampMouse(cl2); + /*HomeMouse();*/ + + sb.sg_flags |= RAW; + stty(1,&sb); + button = Button(0); + FakeMouse(1,0,oldmr.xPos,oldmr.yPos,button); + GrafOn(); +} +#pragma databank 0 + +#define NULL1 ((Pointer)NULL) + +void *daOpen(void) +{ +int oops; + + if (!needsgno()) { + oops = AlertWindow(0x0000,NULL1, + (Ref)"22/Suspend requires that the GNO kernel be active./Cancel"); + return NULL; + } + signal(SIGTSTP,stophandle); + /* This signal will not be delivered immediately because we're + currently inside a tool call. Set up a handler to do the dirty + work outside a tool call */ + kill(getpid(),SIGTSTP); + return NULL; +} + +void daClose(void) +{ +} + +void daAction(long param, int foo) +{ +} + +void daInit(int foo) +{ +}