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 13*3ddebe7eSMichael 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> 256a0a0a80SAxel Dörfler 2633bbe223SAxel Dörfler 273dcb3b07SStephan Aßmus class BMessage; 286a0a0a80SAxel Dörfler 293dcb3b07SStephan Aßmus class DisplayDriver; 303dcb3b07SStephan Aßmus class HWInterface; 313dcb3b07SStephan Aßmus class Layer; 3233bbe223SAxel Dörfler class RootLayer; 3333bbe223SAxel Dörfler class WinBorder; 3433bbe223SAxel Dörfler 356a0a0a80SAxel Dörfler namespace BPrivate { 366a0a0a80SAxel Dörfler class LinkSender; 376a0a0a80SAxel Dörfler }; 386a0a0a80SAxel Dörfler 396a0a0a80SAxel Dörfler 405f2edc0fSAxel Dörfler class Desktop : public MessageLooper, public ScreenOwner { 4133bbe223SAxel Dörfler public: 4233bbe223SAxel Dörfler // startup methods 433dcb3b07SStephan Aßmus Desktop(); 443dcb3b07SStephan Aßmus virtual ~Desktop(); 453dcb3b07SStephan Aßmus 463dcb3b07SStephan Aßmus void Init(); 47770c05d6SAxel Dörfler virtual port_id MessagePort() const { return fMessagePort; } 48770c05d6SAxel Dörfler 49770c05d6SAxel Dörfler void BroadcastToAllApps(int32 code); 5033bbe223SAxel Dörfler 5133bbe223SAxel Dörfler // Methods for multiple monitors. 5294fa2bd2SAdi Oanca inline Screen* ScreenAt(int32 index) const 53fd5bec1eSAxel Dörfler { return fActiveScreen; } 5494fa2bd2SAdi Oanca inline Screen* ActiveScreen() const 5594fa2bd2SAdi Oanca { return fActiveScreen; } 56fd5bec1eSAxel Dörfler inline RootLayer* ActiveRootLayer() const { return fRootLayer; } 57*3ddebe7eSMichael Lotz inline CursorManager& GetCursorManager() { return fCursorManager; } 5833bbe223SAxel Dörfler 59fd5bec1eSAxel Dörfler virtual void ScreenRemoved(Screen* screen) {} 60fd5bec1eSAxel Dörfler virtual void ScreenAdded(Screen* screen) {} 61fd5bec1eSAxel Dörfler virtual bool ReleaseScreen(Screen* screen) { return false; } 623dcb3b07SStephan Aßmus 63fd5bec1eSAxel Dörfler const ::VirtualScreen& VirtualScreen() const { return fVirtualScreen; } 6494fa2bd2SAdi Oanca inline DisplayDriver* GetDisplayDriver() const 65fd5bec1eSAxel Dörfler { return fVirtualScreen.DisplayDriver(); } 6694fa2bd2SAdi Oanca inline HWInterface* GetHWInterface() const 67fd5bec1eSAxel Dörfler { return fVirtualScreen.HWInterface(); } 6894fa2bd2SAdi Oanca 6933bbe223SAxel Dörfler // Methods for layer(WinBorder) manipulation. 7033bbe223SAxel Dörfler void AddWinBorder(WinBorder *winBorder); 7133bbe223SAxel Dörfler void RemoveWinBorder(WinBorder *winBorder); 723dcb3b07SStephan Aßmus void SetWinBorderFeel(WinBorder *winBorder, 733dcb3b07SStephan Aßmus uint32 feel); 743dcb3b07SStephan Aßmus void AddWinBorderToSubset(WinBorder *winBorder, 753dcb3b07SStephan Aßmus WinBorder *toWinBorder); 763dcb3b07SStephan Aßmus void RemoveWinBorderFromSubset(WinBorder *winBorder, 773dcb3b07SStephan Aßmus WinBorder *fromWinBorder); 7833bbe223SAxel Dörfler 796a0a0a80SAxel Dörfler WinBorder* FindWinBorderByClientToken(int32 token, team_id teamID); 806a0a0a80SAxel Dörfler //WinBorder* FindWinBorderByServerToken(int32 token); 816a0a0a80SAxel Dörfler 8233bbe223SAxel Dörfler // get list of registed windows 8333bbe223SAxel Dörfler const BList& WindowList() const 8433bbe223SAxel Dörfler { 8533bbe223SAxel Dörfler if (!IsLocked()) 8633bbe223SAxel Dörfler debugger("You must lock before getting registered windows list\n"); 8733bbe223SAxel Dörfler return fWinBorderList; 8833bbe223SAxel Dörfler } 8933bbe223SAxel Dörfler 906a0a0a80SAxel Dörfler void WriteWindowList(team_id team, BPrivate::LinkSender& sender); 916a0a0a80SAxel Dörfler void WriteWindowInfo(int32 serverToken, BPrivate::LinkSender& sender); 9233bbe223SAxel Dörfler 9333bbe223SAxel Dörfler private: 945f2edc0fSAxel Dörfler virtual void _GetLooperName(char* name, size_t size); 95770c05d6SAxel Dörfler virtual void _PrepareQuit(); 96770c05d6SAxel Dörfler virtual void _DispatchMessage(int32 code, BPrivate::LinkReceiver &link); 975f2edc0fSAxel Dörfler 985f2edc0fSAxel Dörfler private: 99ef8810f2SAxel Dörfler friend class DesktopSettings; 100ef8810f2SAxel Dörfler 101fd5bec1eSAxel Dörfler ::VirtualScreen fVirtualScreen; 102ef8810f2SAxel Dörfler DesktopSettings::Private* fSettings; 1035f2edc0fSAxel Dörfler port_id fMessagePort; 104770c05d6SAxel Dörfler 105770c05d6SAxel Dörfler BLocker fAppListLock; 106770c05d6SAxel Dörfler BList fAppList; 107770c05d6SAxel Dörfler 108770c05d6SAxel Dörfler sem_id fShutdownSemaphore; 109770c05d6SAxel Dörfler int32 fShutdownCount; 110770c05d6SAxel Dörfler 11133bbe223SAxel Dörfler BList fWinBorderList; 11233bbe223SAxel Dörfler 113fd5bec1eSAxel Dörfler RootLayer* fRootLayer; 11433bbe223SAxel Dörfler Screen* fActiveScreen; 115*3ddebe7eSMichael Lotz 116*3ddebe7eSMichael Lotz CursorManager fCursorManager; 11733bbe223SAxel Dörfler }; 11833bbe223SAxel Dörfler 1196390df8eSStefano Ceccherini extern Desktop *gDesktop; 12033bbe223SAxel Dörfler 12133bbe223SAxel Dörfler #endif // _DESKTOP_H_ 122