16a0a0a80SAxel Dörfler /* 26a0a0a80SAxel Dörfler * Copyright 2001-2005, Haiku. 36a0a0a80SAxel Dörfler * Distributed under the terms of the MIT License. 46a0a0a80SAxel Dörfler * 56a0a0a80SAxel Dörfler * Authors: 66a0a0a80SAxel Dörfler * Adrian Oanca <adioanca@cotty.iren.ro> 76a0a0a80SAxel Dörfler * Stephan Aßmus <superstippi@gmx.de> 86a0a0a80SAxel Dörfler * Axel Dörfler, axeld@pinc-software.de 96a0a0a80SAxel Dörfler */ 1033bbe223SAxel Dörfler #ifndef _DESKTOP_H_ 1133bbe223SAxel Dörfler #define _DESKTOP_H_ 1233bbe223SAxel Dörfler 1308f35604SAxel Dörfler 143ddebe7eSMichael Lotz #include "CursorManager.h" 1508f35604SAxel Dörfler #include "EventDispatcher.h" 16fd5bec1eSAxel Dörfler #include "ScreenManager.h" 17fd5bec1eSAxel Dörfler #include "ServerScreen.h" 18fd5bec1eSAxel Dörfler #include "VirtualScreen.h" 19ef8810f2SAxel Dörfler #include "DesktopSettings.h" 205f2edc0fSAxel Dörfler #include "MessageLooper.h" 21fd5bec1eSAxel Dörfler 2233bbe223SAxel Dörfler #include <InterfaceDefs.h> 233dcb3b07SStephan Aßmus #include <List.h> 243dcb3b07SStephan Aßmus #include <Locker.h> 253dcb3b07SStephan Aßmus #include <Menu.h> 266a0a0a80SAxel Dörfler #include <Autolock.h> 2736deda69SAxel Dörfler #include <ObjectList.h> 286a0a0a80SAxel Dörfler 2933bbe223SAxel Dörfler 303dcb3b07SStephan Aßmus class BMessage; 316a0a0a80SAxel Dörfler 3258468dfeSStephan Aßmus class DrawingEngine; 333dcb3b07SStephan Aßmus class HWInterface; 343dcb3b07SStephan Aßmus class Layer; 3533bbe223SAxel Dörfler class RootLayer; 3633bbe223SAxel Dörfler class WinBorder; 3733bbe223SAxel Dörfler 386a0a0a80SAxel Dörfler namespace BPrivate { 396a0a0a80SAxel Dörfler class LinkSender; 406a0a0a80SAxel Dörfler }; 416a0a0a80SAxel Dörfler 426a0a0a80SAxel Dörfler 435f2edc0fSAxel Dörfler class Desktop : public MessageLooper, public ScreenOwner { 4433bbe223SAxel Dörfler public: 4533bbe223SAxel Dörfler // startup methods 4636deda69SAxel Dörfler Desktop(uid_t userID); 473dcb3b07SStephan Aßmus virtual ~Desktop(); 483dcb3b07SStephan Aßmus 493dcb3b07SStephan Aßmus void Init(); 5036deda69SAxel Dörfler 5136deda69SAxel Dörfler uid_t UserID() const { return fUserID; } 52770c05d6SAxel Dörfler virtual port_id MessagePort() const { return fMessagePort; } 53770c05d6SAxel Dörfler 54*f7598223SAxel Dörfler ::EventDispatcher& EventDispatcher() { return fEventDispatcher; } 556c17d025SAxel Dörfler 56770c05d6SAxel Dörfler void BroadcastToAllApps(int32 code); 5733bbe223SAxel Dörfler 5833bbe223SAxel Dörfler // Methods for multiple monitors. 5994fa2bd2SAdi Oanca inline Screen* ScreenAt(int32 index) const 60fd5bec1eSAxel Dörfler { return fActiveScreen; } 6194fa2bd2SAdi Oanca inline Screen* ActiveScreen() const 6294fa2bd2SAdi Oanca { return fActiveScreen; } 63fd5bec1eSAxel Dörfler inline RootLayer* ActiveRootLayer() const { return fRootLayer; } 643ddebe7eSMichael Lotz inline CursorManager& GetCursorManager() { return fCursorManager; } 6533bbe223SAxel Dörfler 66fd5bec1eSAxel Dörfler virtual void ScreenRemoved(Screen* screen) {} 67fd5bec1eSAxel Dörfler virtual void ScreenAdded(Screen* screen) {} 68fd5bec1eSAxel Dörfler virtual bool ReleaseScreen(Screen* screen) { return false; } 693dcb3b07SStephan Aßmus 70fd5bec1eSAxel Dörfler const ::VirtualScreen& VirtualScreen() const { return fVirtualScreen; } 7158468dfeSStephan Aßmus inline DrawingEngine* GetDrawingEngine() const 7258468dfeSStephan Aßmus { return fVirtualScreen.DrawingEngine(); } 7394fa2bd2SAdi Oanca inline HWInterface* GetHWInterface() const 74fd5bec1eSAxel Dörfler { return fVirtualScreen.HWInterface(); } 7594fa2bd2SAdi Oanca 7633bbe223SAxel Dörfler // Methods for layer(WinBorder) manipulation. 7733bbe223SAxel Dörfler void AddWinBorder(WinBorder *winBorder); 7833bbe223SAxel Dörfler void RemoveWinBorder(WinBorder *winBorder); 793dcb3b07SStephan Aßmus void SetWinBorderFeel(WinBorder *winBorder, 803dcb3b07SStephan Aßmus uint32 feel); 813dcb3b07SStephan Aßmus void AddWinBorderToSubset(WinBorder *winBorder, 823dcb3b07SStephan Aßmus WinBorder *toWinBorder); 833dcb3b07SStephan Aßmus void RemoveWinBorderFromSubset(WinBorder *winBorder, 843dcb3b07SStephan Aßmus WinBorder *fromWinBorder); 8533bbe223SAxel Dörfler 866a0a0a80SAxel Dörfler WinBorder* FindWinBorderByClientToken(int32 token, team_id teamID); 876a0a0a80SAxel Dörfler //WinBorder* FindWinBorderByServerToken(int32 token); 886a0a0a80SAxel Dörfler 8933bbe223SAxel Dörfler // get list of registed windows 9036deda69SAxel Dörfler const BObjectList<WinBorder>& WindowList() const; 9133bbe223SAxel Dörfler 926a0a0a80SAxel Dörfler void WriteWindowList(team_id team, BPrivate::LinkSender& sender); 936a0a0a80SAxel Dörfler void WriteWindowInfo(int32 serverToken, BPrivate::LinkSender& sender); 9433bbe223SAxel Dörfler 9533bbe223SAxel Dörfler private: 9636deda69SAxel Dörfler status_t _ActivateApp(team_id team); 975f2edc0fSAxel Dörfler virtual void _GetLooperName(char* name, size_t size); 98770c05d6SAxel Dörfler virtual void _PrepareQuit(); 99770c05d6SAxel Dörfler virtual void _DispatchMessage(int32 code, BPrivate::LinkReceiver &link); 1005f2edc0fSAxel Dörfler 1015f2edc0fSAxel Dörfler private: 102ef8810f2SAxel Dörfler friend class DesktopSettings; 103ef8810f2SAxel Dörfler 10436deda69SAxel Dörfler uid_t fUserID; 105fd5bec1eSAxel Dörfler ::VirtualScreen fVirtualScreen; 106ef8810f2SAxel Dörfler DesktopSettings::Private* fSettings; 1075f2edc0fSAxel Dörfler port_id fMessagePort; 108*f7598223SAxel Dörfler ::EventDispatcher fEventDispatcher; 1096c17d025SAxel Dörfler port_id fInputPort; 110770c05d6SAxel Dörfler 111770c05d6SAxel Dörfler BLocker fAppListLock; 112770c05d6SAxel Dörfler BList fAppList; 113770c05d6SAxel Dörfler 114770c05d6SAxel Dörfler sem_id fShutdownSemaphore; 115770c05d6SAxel Dörfler int32 fShutdownCount; 116770c05d6SAxel Dörfler 11736deda69SAxel Dörfler BObjectList<WinBorder> fWinBorderList; 11833bbe223SAxel Dörfler 119fd5bec1eSAxel Dörfler RootLayer* fRootLayer; 12033bbe223SAxel Dörfler Screen* fActiveScreen; 1213ddebe7eSMichael Lotz 1223ddebe7eSMichael Lotz CursorManager fCursorManager; 12333bbe223SAxel Dörfler }; 12433bbe223SAxel Dörfler 12533bbe223SAxel Dörfler #endif // _DESKTOP_H_ 126