xref: /haiku/src/servers/app/AppServer.h (revision 35a71b19367c9c6bb43385b07b860200aed6223e)
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 
8 #ifndef	_HAIKU_APP_SERVER_H_
9 #define	_HAIKU_APP_SERVER_H_
10 
11 #include <OS.h>
12 #include <Locker.h>
13 #include <List.h>
14 #include <Application.h>
15 #include <Window.h>
16 #include <String.h>
17 
18 #include "ServerConfig.h"
19 #include "MessageLooper.h"
20 
21 class ServerApp;
22 class BitmapManager;
23 class ColorSet;
24 
25 namespace BPrivate {
26 	class PortLink;
27 };
28 
29 /*!
30 	\class AppServer AppServer.h
31 	\brief main manager object for the app_server
32 
33 	File for the main app_server thread. This particular thread monitors for
34 	application start and quit messages. It also starts the housekeeping threads
35 	and initializes most of the server's globals.
36 */
37 
38 class AppServer :
39 	public MessageLooper
40 #if TEST_MODE
41 	, public BApplication
42 #endif
43 {
44 	public:
45 		AppServer();
46 		virtual ~AppServer();
47 
48 		void			RunLooper();
49 		virtual port_id	MessagePort() const { return fMessagePort; }
50 
51 	private:
52 		virtual void	_DispatchMessage(int32 code, BPrivate::LinkReceiver& link);
53 		void			LaunchCursorThread();
54 		void			LaunchInputServer();
55 
56 //		static	int32	PollerThread(void *data);
57 		static	int32	CursorThread(void *data);
58 
59 	private:
60 		port_id			fMessagePort;
61 		port_id			fServerInputPort;
62 
63 		thread_id		fISThreadID;
64 		thread_id		fCursorThreadID;
65 		sem_id			fCursorSem;
66 		area_id			fCursorArea;
67 		uint32			*fCursorAddr;
68 
69 		port_id			fISASPort;
70 		port_id			fISPort;
71 };
72 
73 extern BitmapManager *gBitmapManager;
74 extern ColorSet gGUIColorSet;
75 extern port_id gAppServerPort;
76 
77 #endif	/* _HAIKU_APP_SERVER_H_ */
78