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