summaryrefslogtreecommitdiff
path: root/Sleep.c
blob: 550f93269f0fc332d2aa82900478aade3d69e935 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <proto/exec.h>
#include <proto/intuition.h>
#include <graphics/gfxbase.h>
#include <string.h>

#include "Bobi.h"

extern struct GfxBase	*GfxBase;
extern struct Screen	*mainscreen;
extern char				idstring[];
extern UWORD			mainpalette[];
extern ULONG			rexxsigmask;

/****************************************************************************
**	Screen und so schliessen und schlafen gehn
*/

void SleepFunc(void)
{
	struct Screen *wb;

	static struct NewWindow NewW =
	{
		-1,-1,-1,-1,0,1,CLOSEWINDOW,
		WINDOWDRAG+WINDOWDEPTH+WINDOWCLOSE+NOCAREREFRESH,
		NULL,NULL,idstring,NULL,NULL,0,0,(UWORD)-1,(UWORD)-1,WBENCHSCREEN
	};

	if(wb=(void *)OpenWorkBench())
	{
		struct Window *w;

		if(NewW.LeftEdge<0)
		{
			NewW.Width    = 85+8*strlen(idstring);
			NewW.Height   = wb->RastPort.TxHeight+3;
			NewW.LeftEdge = wb->Width-NewW.Width;
			NewW.TopEdge  = wb->Height-NewW.Height;
		}

		if(w=OpenWindow(&NewW))
		{
			Cleanup(FALSE);
			Wait(SIGMASK(w)|rexxsigmask);
			NewW.LeftEdge = w->LeftEdge;
			NewW.TopEdge  = w->TopEdge;
			CloseWindow(w);
			OpenMain();
			LoadPalette(mainpalette);
			RexxMsgHandler();
		}
		else ShowMonoReq2("Can't open sleep window!");
	}
	else ShowMonoReq2("Can't open the Workbench screen!");
}