AppServer.h revision 3f319b33
1/*
2 * Copyright (c) 2001-2005, Haiku, Inc.
3 * Distributed under the terms of the MIT license.
4 *
5 * Author: DarkWyrm <bpmagic@columbus.rr.com>
6 */
7
8#ifndef	_HAIKU_APP_SERVER_H_
9#define	_HAIKU_APP_SERVER_H_
10
11#include <OS.h>
12#include <Locker.h>
13#include <List.h>
14#include <Application.h>
15#include <Window.h>
16#include <String.h>
17
18#include "ServerConfig.h"
19
20class ServerApp;
21class BitmapManager;
22class ColorSet;
23
24namespace BPrivate {
25	class PortLink;
26};
27
28/*!
29	\class AppServer AppServer.h
30	\brief main manager object for the app_server
31
32	File for the main app_server thread. This particular thread monitors for
33	application start and quit messages. It also starts the housekeeping threads
34	and initializes most of the server's globals.
35*/
36
37class AppServer
38#if TEST_MODE
39	: public BApplication
40#endif
41{
42public:
43						AppServer();
44						~AppServer();
45
46static	int32			PollerThread(void *data);
47static	int32			PicassoThread(void *data);
48		thread_id		Run(void);
49		void 			MainLoop(void);
50
51		void			PostMessage(int32 code);
52		void			DispatchMessage(int32 code, BPrivate::PortLink &link);
53		ServerApp*		FindApp(const char *sig);
54
55private:
56friend	void			BroadcastToAllApps(const int32 &code);
57
58		void			LaunchCursorThread();
59		void			LaunchInputServer();
60static	int32			CursorThread(void *data);
61
62		port_id			fMessagePort;
63		port_id			fServerInputPort;
64
65volatile bool			fQuitting;
66
67		BLocker			fAppListLock;
68		BList			fAppList;
69
70		thread_id		fPicassoThreadID;
71
72		thread_id		fISThreadID;
73		thread_id		fCursorThreadID;
74		sem_id			fCursorSem;
75		area_id			fCursorArea;
76		uint32			*fCursorAddr;
77
78		port_id			fISASPort;
79		port_id			fISPort;
80
81		sem_id			fShutdownSemaphore;
82		int32			fShutdownCount;
83};
84
85extern BitmapManager *gBitmapManager;
86extern ColorSet gGUIColorSet;
87extern port_id gAppServerPort;
88
89#endif	/* _HAIKU_APP_SERVER_H_ */
90