AppServer.h revision 151ebb14dd48d1206adb1e46a05bbbbadaaa6be6
1#ifndef	_OPENBEOS_APP_SERVER_H_
2#define	_OPENBEOS_APP_SERVER_H_
3
4#include <OS.h>
5#include <Locker.h>
6#include <List.h>
7#include <Application.h>
8#include <Window.h>
9#include <String.h>
10#include "Decorator.h"
11#include "ServerConfig.h"
12
13class Layer;
14class BMessage;
15class ServerApp;
16class DisplayDriver;
17class BPortLink;
18class CursorManager;
19class BitmapManager;
20
21/*!
22	\class AppServer AppServer.h
23	\brief main manager object for the app_server
24
25	File for the main app_server thread. This particular thread monitors for
26	application start and quit messages. It also starts the housekeeping threads
27	and initializes most of the server's globals.
28*/
29#if TEST_MODE
30class AppServer : public BApplication
31#else
32class AppServer
33#endif
34{
35public:
36	AppServer(void);
37	~AppServer(void);
38
39	static	int32 PollerThread(void *data);
40	static	int32 PicassoThread(void *data);
41	thread_id Run(void);
42	void MainLoop(void);
43
44	bool LoadDecorator(const char *path);
45	void InitDecorators(void);
46
47	void DispatchMessage(int32 code, BPortLink &link);
48	void Broadcast(int32 code);
49
50	ServerApp* FindApp(const char *sig);
51
52private:
53	void LaunchCursorThread();
54	void LaunchInputServer();
55	static int32 CursorThread(void *data);
56
57	friend	Decorator*	new_decorator(BRect rect, const char *title,
58				int32 wlook, int32 wfeel, int32 wflags, DisplayDriver *ddriver);
59
60	// global function pointer
61	create_decorator	*make_decorator;
62
63	port_id	fMessagePort;
64	port_id	fServerInputPort;
65
66	image_id fDecoratorID;
67
68	BString fDecoratorName;
69
70	volatile bool fQuittingServer;
71
72	BList *fAppList;
73	thread_id fPicassoThreadID;
74
75	thread_id fISThreadID;
76	thread_id fCursorThreadID;
77	sem_id fCursorSem;
78	area_id	fCursorArea;
79	uint32 *fCursorAddr;
80
81	port_id fISASPort;
82	port_id fISPort;
83
84	sem_id 	fActiveAppLock,
85			fAppListLock,
86			fDecoratorLock;
87
88	DisplayDriver *fDriver;
89};
90
91Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel,
92	int32 wflags, DisplayDriver *ddriver);
93
94extern BitmapManager *bitmapmanager;
95extern ColorSet gui_colorset;
96extern AppServer *app_server;
97
98#endif
99