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 133ddebe7eSMichael Lotz #include "CursorManager.h" 14fd5bec1eSAxel Dörfler #include "ScreenManager.h" 15fd5bec1eSAxel Dörfler #include "ServerScreen.h" 16fd5bec1eSAxel Dörfler #include "VirtualScreen.h" 17ef8810f2SAxel Dörfler #include "DesktopSettings.h" 185f2edc0fSAxel Dörfler #include "MessageLooper.h" 19fd5bec1eSAxel Dörfler 2033bbe223SAxel Dörfler #include <InterfaceDefs.h> 213dcb3b07SStephan Aßmus #include <List.h> 223dcb3b07SStephan Aßmus #include <Locker.h> 233dcb3b07SStephan Aßmus #include <Menu.h> 246a0a0a80SAxel Dörfler #include <Autolock.h> 2536deda69SAxel Dörfler #include <ObjectList.h> 266a0a0a80SAxel Dörfler 2733bbe223SAxel Dörfler 283dcb3b07SStephan Aßmus class BMessage; 296a0a0a80SAxel Dörfler 3058468dfeSStephan Aßmus class DrawingEngine; 313dcb3b07SStephan Aßmus class HWInterface; 323dcb3b07SStephan Aßmus class Layer; 3333bbe223SAxel Dörfler class RootLayer; 3433bbe223SAxel Dörfler class WinBorder; 3533bbe223SAxel Dörfler 366a0a0a80SAxel Dörfler namespace BPrivate { 376a0a0a80SAxel Dörfler class LinkSender; 386a0a0a80SAxel Dörfler }; 396a0a0a80SAxel Dörfler 406a0a0a80SAxel Dörfler 415f2edc0fSAxel Dörfler class Desktop : public MessageLooper, public ScreenOwner { 4233bbe223SAxel Dörfler public: 4333bbe223SAxel Dörfler // startup methods 4436deda69SAxel Dörfler Desktop(uid_t userID); 453dcb3b07SStephan Aßmus virtual ~Desktop(); 463dcb3b07SStephan Aßmus 473dcb3b07SStephan Aßmus void Init(); 4836deda69SAxel Dörfler 4936deda69SAxel Dörfler uid_t UserID() const { return fUserID; } 50770c05d6SAxel Dörfler virtual port_id MessagePort() const { return fMessagePort; } 51770c05d6SAxel Dörfler 52*6c17d025SAxel Dörfler void RegisterInputServer(port_id port); 53*6c17d025SAxel Dörfler port_id InputServerPort() { return fInputPort; } 54*6c17d025SAxel Dörfler 55770c05d6SAxel Dörfler void BroadcastToAllApps(int32 code); 5633bbe223SAxel Dörfler 5733bbe223SAxel Dörfler // Methods for multiple monitors. 5894fa2bd2SAdi Oanca inline Screen* ScreenAt(int32 index) const 59fd5bec1eSAxel Dörfler { return fActiveScreen; } 6094fa2bd2SAdi Oanca inline Screen* ActiveScreen() const 6194fa2bd2SAdi Oanca { return fActiveScreen; } 62fd5bec1eSAxel Dörfler inline RootLayer* ActiveRootLayer() const { return fRootLayer; } 633ddebe7eSMichael Lotz inline CursorManager& GetCursorManager() { return fCursorManager; } 6433bbe223SAxel Dörfler 65fd5bec1eSAxel Dörfler virtual void ScreenRemoved(Screen* screen) {} 66fd5bec1eSAxel Dörfler virtual void ScreenAdded(Screen* screen) {} 67fd5bec1eSAxel Dörfler virtual bool ReleaseScreen(Screen* screen) { return false; } 683dcb3b07SStephan Aßmus 69fd5bec1eSAxel Dörfler const ::VirtualScreen& VirtualScreen() const { return fVirtualScreen; } 7058468dfeSStephan Aßmus inline DrawingEngine* GetDrawingEngine() const 7158468dfeSStephan Aßmus { return fVirtualScreen.DrawingEngine(); } 7294fa2bd2SAdi Oanca inline HWInterface* GetHWInterface() const 73fd5bec1eSAxel Dörfler { return fVirtualScreen.HWInterface(); } 7494fa2bd2SAdi Oanca 7533bbe223SAxel Dörfler // Methods for layer(WinBorder) manipulation. 7633bbe223SAxel Dörfler void AddWinBorder(WinBorder *winBorder); 7733bbe223SAxel Dörfler void RemoveWinBorder(WinBorder *winBorder); 783dcb3b07SStephan Aßmus void SetWinBorderFeel(WinBorder *winBorder, 793dcb3b07SStephan Aßmus uint32 feel); 803dcb3b07SStephan Aßmus void AddWinBorderToSubset(WinBorder *winBorder, 813dcb3b07SStephan Aßmus WinBorder *toWinBorder); 823dcb3b07SStephan Aßmus void RemoveWinBorderFromSubset(WinBorder *winBorder, 833dcb3b07SStephan Aßmus WinBorder *fromWinBorder); 8433bbe223SAxel Dörfler 856a0a0a80SAxel Dörfler WinBorder* FindWinBorderByClientToken(int32 token, team_id teamID); 866a0a0a80SAxel Dörfler //WinBorder* FindWinBorderByServerToken(int32 token); 876a0a0a80SAxel Dörfler 8833bbe223SAxel Dörfler // get list of registed windows 8936deda69SAxel Dörfler const BObjectList<WinBorder>& WindowList() const; 9033bbe223SAxel Dörfler 916a0a0a80SAxel Dörfler void WriteWindowList(team_id team, BPrivate::LinkSender& sender); 926a0a0a80SAxel Dörfler void WriteWindowInfo(int32 serverToken, BPrivate::LinkSender& sender); 9333bbe223SAxel Dörfler 9433bbe223SAxel Dörfler private: 9536deda69SAxel Dörfler status_t _ActivateApp(team_id team); 965f2edc0fSAxel Dörfler virtual void _GetLooperName(char* name, size_t size); 97770c05d6SAxel Dörfler virtual void _PrepareQuit(); 98770c05d6SAxel Dörfler virtual void _DispatchMessage(int32 code, BPrivate::LinkReceiver &link); 995f2edc0fSAxel Dörfler 1005f2edc0fSAxel Dörfler private: 101ef8810f2SAxel Dörfler friend class DesktopSettings; 102ef8810f2SAxel Dörfler 10336deda69SAxel Dörfler uid_t fUserID; 104fd5bec1eSAxel Dörfler ::VirtualScreen fVirtualScreen; 105ef8810f2SAxel Dörfler DesktopSettings::Private* fSettings; 1065f2edc0fSAxel Dörfler port_id fMessagePort; 107*6c17d025SAxel Dörfler port_id fInputPort; 108770c05d6SAxel Dörfler 109770c05d6SAxel Dörfler BLocker fAppListLock; 110770c05d6SAxel Dörfler BList fAppList; 111770c05d6SAxel Dörfler 112770c05d6SAxel Dörfler sem_id fShutdownSemaphore; 113770c05d6SAxel Dörfler int32 fShutdownCount; 114770c05d6SAxel Dörfler 11536deda69SAxel Dörfler BObjectList<WinBorder> fWinBorderList; 11633bbe223SAxel Dörfler 117fd5bec1eSAxel Dörfler RootLayer* fRootLayer; 11833bbe223SAxel Dörfler Screen* fActiveScreen; 1193ddebe7eSMichael Lotz 1203ddebe7eSMichael Lotz CursorManager fCursorManager; 12133bbe223SAxel Dörfler }; 12233bbe223SAxel Dörfler 12333bbe223SAxel Dörfler #endif // _DESKTOP_H_ 124