AppServer.h revision be05d56c7eea834b5983ba3411d79fabd8b616b7
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	APP_SERVER_H
8#define	APP_SERVER_H
9
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#include <ObjectList.h>
18#include <TokenSpace.h>
19
20#include "ServerConfig.h"
21#include "MessageLooper.h"
22
23class ServerApp;
24class BitmapManager;
25class ColorSet;
26class Desktop;
27
28using BPrivate::BTokenSpace;
29
30namespace BPrivate {
31	class PortLink;
32};
33
34
35class 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);
47		Desktop*		_FindDesktop(uid_t userID);
48
49		void			_LaunchCursorThread();
50		void			_LaunchInputServer();
51
52		static int32	_CursorThread(void *data);
53
54	private:
55		port_id			fMessagePort;
56		port_id			fServerInputPort;
57
58		thread_id		fISThreadID;
59		thread_id		fCursorThreadID;
60		sem_id			fCursorSem;
61		area_id			fCursorArea;
62		uint32			*fCursorAddr;
63
64		BObjectList<Desktop> fDesktops;
65		BLocker			fDesktopLock;
66
67		port_id			fISASPort;
68		port_id			fISPort;
69};
70
71extern BitmapManager *gBitmapManager;
72extern ColorSet gGUIColorSet;
73extern port_id gAppServerPort;
74
75#endif	/* APP_SERVER_H */
76