AppServer.h revision 36deda69baff1eaaa1ba0693a3e06f03cb6a1839
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#include <ObjectList.h>
18
19#include "ServerConfig.h"
20#include "MessageLooper.h"
21
22class ServerApp;
23class BitmapManager;
24class ColorSet;
25class Desktop;
26
27namespace BPrivate {
28	class PortLink;
29};
30
31/*!
32	\class AppServer AppServer.h
33	\brief main manager object for the app_server
34
35	File for the main app_server thread. This particular thread monitors for
36	application start and quit messages. It also starts the housekeeping threads
37	and initializes most of the server's globals.
38*/
39
40class AppServer : public MessageLooper  {
41	public:
42		AppServer();
43		virtual ~AppServer();
44
45		void			RunLooper();
46		virtual port_id	MessagePort() const { return fMessagePort; }
47
48	private:
49		virtual void	_DispatchMessage(int32 code, BPrivate::LinkReceiver& link);
50
51		Desktop*		_CreateDesktop(uid_t userID);
52		Desktop*		_FindDesktop(uid_t userID);
53
54		void			_LaunchCursorThread();
55		void			_LaunchInputServer();
56
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		BObjectList<Desktop> fDesktops;
70		BLocker			fDesktopLock;
71
72		port_id			fISASPort;
73		port_id			fISPort;
74};
75
76extern BitmapManager *gBitmapManager;
77extern ColorSet gGUIColorSet;
78extern port_id gAppServerPort;
79
80#endif	/* _HAIKU_APP_SERVER_H_ */
81