2005-07-05 22:14:24 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2005, Haiku.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Adrian Oanca <adioanca@cotty.iren.ro>
|
|
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
*/
|
2004-01-12 01:12:55 +03:00
|
|
|
#ifndef _DESKTOP_H_
|
|
|
|
#define _DESKTOP_H_
|
2003-01-24 18:19:27 +03:00
|
|
|
|
2005-08-21 14:28:40 +04:00
|
|
|
#include "CursorManager.h"
|
2005-07-15 16:45:23 +04:00
|
|
|
#include "ScreenManager.h"
|
|
|
|
#include "ServerScreen.h"
|
|
|
|
#include "VirtualScreen.h"
|
2005-07-17 20:25:48 +04:00
|
|
|
#include "DesktopSettings.h"
|
2005-07-24 21:14:17 +04:00
|
|
|
#include "MessageLooper.h"
|
2005-07-15 16:45:23 +04:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
#include <InterfaceDefs.h>
|
2004-01-12 01:12:55 +03:00
|
|
|
#include <List.h>
|
2005-06-24 03:46:17 +04:00
|
|
|
#include <Locker.h>
|
2003-07-06 23:48:17 +04:00
|
|
|
#include <Menu.h>
|
2005-07-05 22:14:24 +04:00
|
|
|
#include <Autolock.h>
|
|
|
|
|
2003-01-24 18:19:27 +03:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
class BMessage;
|
2005-07-05 22:14:24 +04:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
class DisplayDriver;
|
|
|
|
class HWInterface;
|
|
|
|
class Layer;
|
2004-01-12 01:12:55 +03:00
|
|
|
class RootLayer;
|
2003-08-31 21:38:34 +04:00
|
|
|
class WinBorder;
|
2003-01-24 18:19:27 +03:00
|
|
|
|
2005-07-05 22:14:24 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
class LinkSender;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-07-24 21:14:17 +04:00
|
|
|
class Desktop : public MessageLooper, public ScreenOwner {
|
2005-06-24 03:46:17 +04:00
|
|
|
public:
|
2004-01-22 03:32:07 +03:00
|
|
|
// startup methods
|
2005-06-24 03:46:17 +04:00
|
|
|
Desktop();
|
|
|
|
virtual ~Desktop();
|
|
|
|
|
|
|
|
void Init();
|
2005-07-26 01:08:34 +04:00
|
|
|
virtual port_id MessagePort() const { return fMessagePort; }
|
|
|
|
|
|
|
|
void BroadcastToAllApps(int32 code);
|
2004-01-22 03:32:07 +03:00
|
|
|
|
|
|
|
// Methods for multiple monitors.
|
2005-06-25 12:45:00 +04:00
|
|
|
inline Screen* ScreenAt(int32 index) const
|
2005-07-15 16:45:23 +04:00
|
|
|
{ return fActiveScreen; }
|
2005-06-25 12:45:00 +04:00
|
|
|
inline Screen* ActiveScreen() const
|
|
|
|
{ return fActiveScreen; }
|
2005-07-15 16:45:23 +04:00
|
|
|
inline RootLayer* ActiveRootLayer() const { return fRootLayer; }
|
2005-08-21 14:28:40 +04:00
|
|
|
inline CursorManager& GetCursorManager() { return fCursorManager; }
|
2005-06-25 12:45:00 +04:00
|
|
|
|
2005-07-15 16:45:23 +04:00
|
|
|
virtual void ScreenRemoved(Screen* screen) {}
|
|
|
|
virtual void ScreenAdded(Screen* screen) {}
|
|
|
|
virtual bool ReleaseScreen(Screen* screen) { return false; }
|
2005-06-25 12:45:00 +04:00
|
|
|
|
2005-07-15 16:45:23 +04:00
|
|
|
const ::VirtualScreen& VirtualScreen() const { return fVirtualScreen; }
|
2005-06-25 12:45:00 +04:00
|
|
|
inline DisplayDriver* GetDisplayDriver() const
|
2005-07-15 16:45:23 +04:00
|
|
|
{ return fVirtualScreen.DisplayDriver(); }
|
2005-06-25 12:45:00 +04:00
|
|
|
inline HWInterface* GetHWInterface() const
|
2005-07-15 16:45:23 +04:00
|
|
|
{ return fVirtualScreen.HWInterface(); }
|
2005-06-24 03:46:17 +04:00
|
|
|
|
2004-01-22 03:32:07 +03:00
|
|
|
// Methods for layer(WinBorder) manipulation.
|
2005-06-24 03:46:17 +04:00
|
|
|
void AddWinBorder(WinBorder *winBorder);
|
|
|
|
void RemoveWinBorder(WinBorder *winBorder);
|
|
|
|
void SetWinBorderFeel(WinBorder *winBorder,
|
|
|
|
uint32 feel);
|
|
|
|
void AddWinBorderToSubset(WinBorder *winBorder,
|
|
|
|
WinBorder *toWinBorder);
|
|
|
|
void RemoveWinBorderFromSubset(WinBorder *winBorder,
|
|
|
|
WinBorder *fromWinBorder);
|
2004-07-07 00:51:16 +04:00
|
|
|
|
2005-07-05 22:14:24 +04:00
|
|
|
WinBorder* FindWinBorderByClientToken(int32 token, team_id teamID);
|
|
|
|
//WinBorder* FindWinBorderByServerToken(int32 token);
|
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
// get list of registed windows
|
2005-06-24 03:46:17 +04:00
|
|
|
const BList& WindowList() const
|
|
|
|
{
|
|
|
|
if (!IsLocked())
|
|
|
|
debugger("You must lock before getting registered windows list\n");
|
|
|
|
return fWinBorderList;
|
|
|
|
}
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2005-07-05 22:14:24 +04:00
|
|
|
void WriteWindowList(team_id team, BPrivate::LinkSender& sender);
|
|
|
|
void WriteWindowInfo(int32 serverToken, BPrivate::LinkSender& sender);
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2005-07-24 21:14:17 +04:00
|
|
|
private:
|
|
|
|
virtual void _GetLooperName(char* name, size_t size);
|
2005-07-26 01:08:34 +04:00
|
|
|
virtual void _PrepareQuit();
|
|
|
|
virtual void _DispatchMessage(int32 code, BPrivate::LinkReceiver &link);
|
2005-07-24 21:14:17 +04:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
private:
|
2005-07-17 20:25:48 +04:00
|
|
|
friend class DesktopSettings;
|
|
|
|
|
2005-07-15 16:45:23 +04:00
|
|
|
::VirtualScreen fVirtualScreen;
|
2005-07-17 20:25:48 +04:00
|
|
|
DesktopSettings::Private* fSettings;
|
2005-07-24 21:14:17 +04:00
|
|
|
port_id fMessagePort;
|
2005-07-26 01:08:34 +04:00
|
|
|
|
|
|
|
BLocker fAppListLock;
|
|
|
|
BList fAppList;
|
|
|
|
|
|
|
|
sem_id fShutdownSemaphore;
|
|
|
|
int32 fShutdownCount;
|
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
BList fWinBorderList;
|
2005-07-15 16:45:23 +04:00
|
|
|
|
|
|
|
RootLayer* fRootLayer;
|
2005-06-24 03:46:17 +04:00
|
|
|
Screen* fActiveScreen;
|
2005-08-21 14:28:40 +04:00
|
|
|
|
|
|
|
CursorManager fCursorManager;
|
2004-01-12 01:12:55 +03:00
|
|
|
};
|
2003-07-06 23:48:17 +04:00
|
|
|
|
2005-07-05 22:14:24 +04:00
|
|
|
#endif // _DESKTOP_H_
|