AppServer.h revision 2724858b
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#include "Decorator.h"
17#include "ServerConfig.h"
18
19class Layer;
20class BMessage;
21class ServerApp;
22class DisplayDriver;
23class BPortLink;
24class CursorManager;
25class BitmapManager;
26
27/*!
28	\class AppServer AppServer.h
29	\brief main manager object for the app_server
30
31	File for the main app_server thread. This particular thread monitors for
32	application start and quit messages. It also starts the housekeeping threads
33	and initializes most of the server's globals.
34*/
35
36class AppServer
37#if TEST_MODE
38	: public BApplication
39#endif
40{
41public:
42	AppServer(void);
43	~AppServer(void);
44
45	static	int32 PollerThread(void *data);
46	static	int32 PicassoThread(void *data);
47	thread_id Run(void);
48	void MainLoop(void);
49
50	bool LoadDecorator(const char *path);
51	void InitDecorators(void);
52
53	void DispatchMessage(int32 code, BPortLink &link);
54	void Broadcast(int32 code);
55
56	ServerApp* FindApp(const char *sig);
57
58private:
59	void LaunchCursorThread();
60	void LaunchInputServer();
61	static int32 CursorThread(void *data);
62
63	friend	Decorator*	new_decorator(BRect rect, const char *title,
64				int32 wlook, int32 wfeel, int32 wflags, DisplayDriver *ddriver);
65
66	// global function pointer
67	create_decorator	*make_decorator;
68
69	port_id	fMessagePort;
70	port_id	fServerInputPort;
71
72	image_id fDecoratorID;
73
74	BString fDecoratorName;
75
76	volatile bool fQuittingServer;
77
78	BList *fAppList;
79	thread_id fPicassoThreadID;
80
81	thread_id fISThreadID;
82	thread_id fCursorThreadID;
83	sem_id fCursorSem;
84	area_id	fCursorArea;
85	uint32 *fCursorAddr;
86
87	port_id fISASPort;
88	port_id fISPort;
89
90	sem_id 	fActiveAppLock,
91			fAppListLock,
92			fDecoratorLock;
93
94	DisplayDriver *fDriver;
95};
96
97Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel,
98	int32 wflags, DisplayDriver *ddriver);
99
100extern BitmapManager *bitmapmanager;
101extern ColorSet gui_colorset;
102extern AppServer *app_server;
103extern port_id gAppServerPort;
104
105#endif	/* _HAIKU_APP_SERVER_H_ */
106