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
|
|
|
|
*/
|
2005-11-29 02:36:59 +03:00
|
|
|
#ifndef DESKTOP_H
|
|
|
|
#define DESKTOP_H
|
2003-01-24 18:19:27 +03:00
|
|
|
|
2005-11-17 17:58:19 +03:00
|
|
|
|
2005-08-21 14:28:40 +04:00
|
|
|
#include "CursorManager.h"
|
2005-11-17 17:58:19 +03:00
|
|
|
#include "EventDispatcher.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-11-29 02:36:59 +03:00
|
|
|
#include "Workspace.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>
|
2005-10-31 22:35:46 +03:00
|
|
|
#include <ObjectList.h>
|
2005-07-05 22:14:24 +04:00
|
|
|
|
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-11-04 18:23:54 +03:00
|
|
|
class DrawingEngine;
|
2005-06-24 03:46:17 +04:00
|
|
|
class HWInterface;
|
|
|
|
class Layer;
|
2004-01-12 01:12:55 +03:00
|
|
|
class RootLayer;
|
2005-11-24 20:45:26 +03:00
|
|
|
class WindowLayer;
|
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-11-29 02:36:59 +03:00
|
|
|
public:
|
2005-10-31 22:35:46 +03:00
|
|
|
Desktop(uid_t userID);
|
2005-11-29 02:36:59 +03:00
|
|
|
virtual ~Desktop();
|
2005-06-24 03:46:17 +04:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
void Init();
|
2005-10-31 22:35:46 +03:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
uid_t UserID() const { return fUserID; }
|
|
|
|
virtual port_id MessagePort() const { return fMessagePort; }
|
2005-07-26 01:08:34 +04:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
::EventDispatcher& EventDispatcher() { return fEventDispatcher; }
|
2005-11-15 22:59:53 +03:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
void BroadcastToAllApps(int32 code);
|
2004-01-22 03:32:07 +03:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
// Screen and drawing related methods
|
|
|
|
|
|
|
|
Screen* ScreenAt(int32 index) const
|
2005-07-15 16:45:23 +04:00
|
|
|
{ return fActiveScreen; }
|
2005-11-29 02:36:59 +03:00
|
|
|
Screen* ActiveScreen() const
|
2005-06-25 12:45:00 +04:00
|
|
|
{ return fActiveScreen; }
|
2005-11-29 02:36:59 +03:00
|
|
|
::RootLayer* RootLayer() const { return fRootLayer; }
|
|
|
|
CursorManager& GetCursorManager() { return fCursorManager; }
|
2005-06-25 12:45:00 +04:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
void ScreenChanged(Screen* screen);
|
2005-11-26 19:56:52 +03:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
void ScreenRemoved(Screen* screen) {}
|
|
|
|
void ScreenAdded(Screen* screen) {}
|
|
|
|
bool ReleaseScreen(Screen* screen) { return false; }
|
2005-06-25 12:45:00 +04:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
const ::VirtualScreen& VirtualScreen() const { return fVirtualScreen; }
|
|
|
|
DrawingEngine* GetDrawingEngine() const
|
2005-11-04 18:23:54 +03:00
|
|
|
{ return fVirtualScreen.DrawingEngine(); }
|
2005-11-29 02:36:59 +03:00
|
|
|
::HWInterface* HWInterface() const
|
2005-07-15 16:45:23 +04:00
|
|
|
{ return fVirtualScreen.HWInterface(); }
|
2005-06-24 03:46:17 +04:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
// Workspace methods
|
|
|
|
|
|
|
|
void SetWorkspace(int32 index);
|
|
|
|
int32 CurrentWorkspace()
|
|
|
|
{ return fCurrentWorkspace; }
|
|
|
|
::Workspace& WorkspaceAt(int32 index)
|
|
|
|
{ return fWorkspaces[index]; }
|
|
|
|
|
|
|
|
// WindowLayer methods
|
|
|
|
|
|
|
|
void ActivateWindow(WindowLayer* window);
|
|
|
|
void SendBehindWindow(WindowLayer* window, WindowLayer* front);
|
|
|
|
|
2005-11-30 13:45:01 +03:00
|
|
|
void ShowWindow(WindowLayer* window);
|
|
|
|
void HideWindow(WindowLayer* window);
|
|
|
|
|
2005-11-30 18:47:01 +03:00
|
|
|
void SetWindowWorkspaces(WindowLayer* window,
|
|
|
|
uint32 workspaces);
|
2005-11-29 02:36:59 +03:00
|
|
|
|
2005-11-30 18:47:01 +03:00
|
|
|
void AddWindow(WindowLayer *window);
|
|
|
|
void RemoveWindow(WindowLayer *window);
|
|
|
|
void SetWindowFeel(WindowLayer *window, uint32 feel);
|
|
|
|
void SetWindowLook(WindowLayer *window, uint32 look);
|
2005-11-29 02:36:59 +03:00
|
|
|
|
|
|
|
WindowLayer* FindWindowLayerByClientToken(int32 token, team_id teamID);
|
|
|
|
//WindowLayer* FindWindowLayerByServerToken(int32 token);
|
|
|
|
|
|
|
|
// get list of registed windows
|
|
|
|
const BObjectList<WindowLayer>& WindowList() const;
|
|
|
|
|
|
|
|
void WriteWindowList(team_id team,
|
|
|
|
BPrivate::LinkSender& sender);
|
|
|
|
void WriteWindowInfo(int32 serverToken,
|
|
|
|
BPrivate::LinkSender& sender);
|
|
|
|
|
|
|
|
private:
|
2005-11-30 18:47:01 +03:00
|
|
|
void _ChangeWindowWorkspaces(WindowLayer* window,
|
|
|
|
uint32 oldWorkspaces, uint32 newWorkspaces);
|
2005-11-29 02:36:59 +03:00
|
|
|
status_t _ActivateApp(team_id team);
|
|
|
|
void _GetLooperName(char* name, size_t size);
|
|
|
|
void _PrepareQuit();
|
|
|
|
void _DispatchMessage(int32 code,
|
|
|
|
BPrivate::LinkReceiver &link);
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class DesktopSettings;
|
|
|
|
|
|
|
|
uid_t fUserID;
|
|
|
|
::VirtualScreen fVirtualScreen;
|
|
|
|
DesktopSettings::Private* fSettings;
|
|
|
|
port_id fMessagePort;
|
|
|
|
::EventDispatcher fEventDispatcher;
|
|
|
|
port_id fInputPort;
|
|
|
|
|
|
|
|
BLocker fAppListLock;
|
|
|
|
BList fAppList;
|
|
|
|
|
|
|
|
sem_id fShutdownSemaphore;
|
|
|
|
int32 fShutdownCount;
|
|
|
|
|
|
|
|
::Workspace fWorkspaces[32];//kMaxWorkspaces];
|
|
|
|
int32 fCurrentWorkspace;
|
|
|
|
|
|
|
|
BObjectList<WindowLayer> fWindowLayerList;
|
|
|
|
|
|
|
|
::RootLayer* fRootLayer;
|
|
|
|
Screen* fActiveScreen;
|
|
|
|
|
|
|
|
CursorManager fCursorManager;
|
2004-01-12 01:12:55 +03:00
|
|
|
};
|
2003-07-06 23:48:17 +04:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
#endif // DESKTOP_H
|