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