xref: /haiku/src/servers/app/AppServer.h (revision b8d27287f902c5529f1ac8ef0dd5e70006b763f1)
133bbe223SAxel Dörfler #ifndef	_OPENBEOS_APP_SERVER_H_
233bbe223SAxel Dörfler #define	_OPENBEOS_APP_SERVER_H_
333bbe223SAxel Dörfler 
433bbe223SAxel Dörfler #include <OS.h>
533bbe223SAxel Dörfler #include <Locker.h>
633bbe223SAxel Dörfler #include <List.h>
733bbe223SAxel Dörfler #include <Application.h>
833bbe223SAxel Dörfler #include <Window.h>
933bbe223SAxel Dörfler #include <String.h>
1033bbe223SAxel Dörfler #include "Decorator.h"
1133bbe223SAxel Dörfler #include "ServerConfig.h"
1233bbe223SAxel Dörfler 
1333bbe223SAxel Dörfler class Layer;
1433bbe223SAxel Dörfler class BMessage;
1533bbe223SAxel Dörfler class ServerApp;
1633bbe223SAxel Dörfler class DisplayDriver;
1733bbe223SAxel Dörfler class BPortLink;
1833bbe223SAxel Dörfler class CursorManager;
1933bbe223SAxel Dörfler class BitmapManager;
2033bbe223SAxel Dörfler 
2133bbe223SAxel Dörfler /*!
2233bbe223SAxel Dörfler 	\class AppServer AppServer.h
2333bbe223SAxel Dörfler 	\brief main manager object for the app_server
2433bbe223SAxel Dörfler 
2533bbe223SAxel Dörfler 	File for the main app_server thread. This particular thread monitors for
2633bbe223SAxel Dörfler 	application start and quit messages. It also starts the housekeeping threads
2733bbe223SAxel Dörfler 	and initializes most of the server's globals.
2833bbe223SAxel Dörfler */
299775bf33SMichael Lotz #if TEST_MODE
3033bbe223SAxel Dörfler class AppServer : public BApplication
319775bf33SMichael Lotz #else
329775bf33SMichael Lotz class AppServer
3333bbe223SAxel Dörfler #endif
3433bbe223SAxel Dörfler {
3533bbe223SAxel Dörfler public:
3633bbe223SAxel Dörfler 	AppServer(void);
3733bbe223SAxel Dörfler 	~AppServer(void);
3833bbe223SAxel Dörfler 
3933bbe223SAxel Dörfler 	static	int32 PollerThread(void *data);
4033bbe223SAxel Dörfler 	static	int32 PicassoThread(void *data);
4133bbe223SAxel Dörfler 	thread_id Run(void);
4233bbe223SAxel Dörfler 	void MainLoop(void);
4333bbe223SAxel Dörfler 
4433bbe223SAxel Dörfler 	bool LoadDecorator(const char *path);
4533bbe223SAxel Dörfler 	void InitDecorators(void);
4633bbe223SAxel Dörfler 
4733bbe223SAxel Dörfler 	void DispatchMessage(int32 code, BPortLink &link);
4833bbe223SAxel Dörfler 	void Broadcast(int32 code);
4933bbe223SAxel Dörfler 
5033bbe223SAxel Dörfler 	ServerApp* FindApp(const char *sig);
5133bbe223SAxel Dörfler 
5233bbe223SAxel Dörfler private:
53*b8d27287SJérôme Duval 	void LaunchCursorThread();
54*b8d27287SJérôme Duval 	void LaunchInputServer();
55*b8d27287SJérôme Duval 	static int32 CursorThread(void *data);
56*b8d27287SJérôme Duval 
5733bbe223SAxel Dörfler 	friend	Decorator*	new_decorator(BRect rect, const char *title,
5833bbe223SAxel Dörfler 				int32 wlook, int32 wfeel, int32 wflags, DisplayDriver *ddriver);
5933bbe223SAxel Dörfler 
6033bbe223SAxel Dörfler 	// global function pointer
6133bbe223SAxel Dörfler 	create_decorator	*make_decorator;
6233bbe223SAxel Dörfler 
6333bbe223SAxel Dörfler 	port_id	fMessagePort;
64597c548cSMichael Lotz 	port_id	fServerInputPort;
6533bbe223SAxel Dörfler 
6633bbe223SAxel Dörfler 	image_id fDecoratorID;
6733bbe223SAxel Dörfler 
6833bbe223SAxel Dörfler 	BString fDecoratorName;
6933bbe223SAxel Dörfler 
7033bbe223SAxel Dörfler 	bool fQuittingServer;
7133bbe223SAxel Dörfler 
7233bbe223SAxel Dörfler 	BList *fAppList;
7333bbe223SAxel Dörfler 	thread_id fPicassoThreadID;
7433bbe223SAxel Dörfler 
75*b8d27287SJérôme Duval 	thread_id fISThreadID;
76*b8d27287SJérôme Duval 	thread_id fCursorThreadID;
77*b8d27287SJérôme Duval 	sem_id fCursorSem;
78*b8d27287SJérôme Duval 	area_id	fCursorArea;
79*b8d27287SJérôme Duval 	uint32 *fCursorAddr;
80*b8d27287SJérôme Duval 
81*b8d27287SJérôme Duval 	port_id fISASPort;
82*b8d27287SJérôme Duval 	port_id fISPort;
83*b8d27287SJérôme Duval 
8433bbe223SAxel Dörfler 	sem_id 	fActiveAppLock,
8533bbe223SAxel Dörfler 			fAppListLock,
8633bbe223SAxel Dörfler 			fDecoratorLock;
8733bbe223SAxel Dörfler 
8833bbe223SAxel Dörfler 	DisplayDriver *fDriver;
8933bbe223SAxel Dörfler };
9033bbe223SAxel Dörfler 
9133bbe223SAxel Dörfler Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel,
9233bbe223SAxel Dörfler 	int32 wflags, DisplayDriver *ddriver);
9333bbe223SAxel Dörfler 
9433bbe223SAxel Dörfler extern BitmapManager *bitmapmanager;
9533bbe223SAxel Dörfler extern ColorSet gui_colorset;
9633bbe223SAxel Dörfler extern AppServer *app_server;
9733bbe223SAxel Dörfler 
9833bbe223SAxel Dörfler #endif
99