xref: /haiku/src/servers/app/AppServer.h (revision 9775bf33cf929b0e4718b791c3ef11d3fe82ef1e)
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 
13 class Layer;
14 class BMessage;
15 class ServerApp;
16 class DisplayDriver;
17 class BPortLink;
18 class CursorManager;
19 class 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
30 class AppServer : public BApplication
31 #else
32 class AppServer
33 #endif
34 {
35 public:
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 
52 private:
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 
77 Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel,
78 	int32 wflags, DisplayDriver *ddriver);
79 
80 extern BitmapManager *bitmapmanager;
81 extern ColorSet gui_colorset;
82 extern AppServer *app_server;
83 
84 #endif
85