AppServer.h revision c98108eee32f88a7c74747fd25f355451a72c8ed
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#ifndef TEST_MODE
30class AppServer
31#else
32class AppServer : public BApplication
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	friend	Decorator*	new_decorator(BRect rect, const char *title,
54				int32 wlook, int32 wfeel, int32 wflags, DisplayDriver *ddriver);
55
56	// global function pointer
57	create_decorator	*make_decorator;
58
59	port_id	fMessagePort;
60
61	image_id fDecoratorID;
62
63	BString fDecoratorName;
64
65	bool fQuittingServer;
66
67	BList *fAppList;
68	thread_id fPicassoThreadID;
69
70	sem_id 	fActiveAppLock,
71			fAppListLock,
72			fDecoratorLock;
73
74	DisplayDriver *fDriver;
75};
76
77Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel,
78	int32 wflags, DisplayDriver *ddriver);
79
80extern BitmapManager *bitmapmanager;
81extern ColorSet gui_colorset;
82extern AppServer *app_server;
83
84#endif
85