xref: /haiku/src/servers/app/AppServer.h (revision 25a7b01d15612846f332751841da3579db313082)
1 /*
2  * Copyright 2001-2011, Haiku, Inc.
3  * Distributed under the terms of the MIT license.
4  *
5  * Authors:
6  *		DarkWyrm <bpmagic@columbus.rr.com>
7  */
8 #ifndef	APP_SERVER_H
9 #define	APP_SERVER_H
10 
11 
12 #include <OS.h>
13 #include <Locker.h>
14 #include <List.h>
15 #include <Application.h>
16 #include <Window.h>
17 #include <String.h>
18 #include <ObjectList.h>
19 #include <TokenSpace.h>
20 
21 #include "ServerConfig.h"
22 #include "MessageLooper.h"
23 
24 class ServerApp;
25 class BitmapManager;
26 class Desktop;
27 
28 using BPrivate::BTokenSpace;
29 
30 namespace BPrivate {
31 	class PortLink;
32 };
33 
34 
35 class AppServer : public MessageLooper  {
36 	public:
37 		AppServer();
38 		virtual ~AppServer();
39 
40 		void			RunLooper();
41 		virtual port_id	MessagePort() const { return fMessagePort; }
42 
43 	private:
44 		virtual void	_DispatchMessage(int32 code, BPrivate::LinkReceiver& link);
45 
46 		Desktop*		_CreateDesktop(uid_t userID, const char* targetScreen);
47 		Desktop*		_FindDesktop(uid_t userID, const char* targetScreen);
48 
49 		void			_LaunchInputServer();
50 
51 	private:
52 		port_id			fMessagePort;
53 
54 		BObjectList<Desktop> fDesktops;
55 		BLocker			fDesktopLock;
56 };
57 
58 
59 extern BitmapManager *gBitmapManager;
60 extern port_id gAppServerPort;
61 
62 
63 #endif	/* APP_SERVER_H */
64