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-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-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-06-24 03:46:17 +04:00
|
|
|
public:
|
2004-01-22 03:32:07 +03:00
|
|
|
// startup methods
|
2005-10-31 22:35:46 +03:00
|
|
|
Desktop(uid_t userID);
|
2005-06-24 03:46:17 +04:00
|
|
|
virtual ~Desktop();
|
|
|
|
|
|
|
|
void Init();
|
2005-10-31 22:35:46 +03:00
|
|
|
|
|
|
|
uid_t UserID() const { return fUserID; }
|
2005-07-26 01:08:34 +04:00
|
|
|
virtual port_id MessagePort() const { return fMessagePort; }
|
|
|
|
|
* the new input event dispatcher is now actually used, although it doesn't
distribute any messages to the clients yet.
* removed the working thread from RootLayer - for now, its event handlers are
still called using input filters in the new event dispatcher, though (to
get things started).
* ServerApp is now using a BMessenger to identify its client, and no longer
stores the port/token separately.
* the input_server handshake is a bit simpler now, as it can now just reply
to the app_server message, removed unused code from ServerProtocol.h
* calmed down the MultiLocker (it always printed thread statistics on startup,
because it's compiled in debug mode).
* removed the cursor thread stuff from AppServer.cpp
* the new event dispatcher now uses a cursor thread when supported (only in
native mode, not in the test environment), although it improves cursor
movement under Qemu, the effect is not as good as expected - this might
need some more investigations (might just be a thread priority problem).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15012 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-18 14:30:06 +03:00
|
|
|
::EventDispatcher& EventDispatcher() { return fEventDispatcher; }
|
2005-11-15 22:59:53 +03:00
|
|
|
|
2005-07-26 01:08:34 +04:00
|
|
|
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-11-18 16:51:32 +03:00
|
|
|
inline ::RootLayer* RootLayer() 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-11-26 19:56:52 +03:00
|
|
|
void ScreenChanged(Screen* screen);
|
|
|
|
|
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-11-04 18:23:54 +03:00
|
|
|
inline DrawingEngine* GetDrawingEngine() const
|
|
|
|
{ return fVirtualScreen.DrawingEngine(); }
|
2005-11-18 15:26:20 +03:00
|
|
|
inline ::HWInterface* HWInterface() const
|
2005-07-15 16:45:23 +04:00
|
|
|
{ return fVirtualScreen.HWInterface(); }
|
2005-06-24 03:46:17 +04:00
|
|
|
|
2005-11-24 20:45:26 +03:00
|
|
|
// Methods for layer(WindowLayer) manipulation.
|
|
|
|
void AddWindowLayer(WindowLayer *winBorder);
|
|
|
|
void RemoveWindowLayer(WindowLayer *winBorder);
|
|
|
|
void SetWindowLayerFeel(WindowLayer *winBorder,
|
2005-06-24 03:46:17 +04:00
|
|
|
uint32 feel);
|
2005-11-24 20:45:26 +03:00
|
|
|
void AddWindowLayerToSubset(WindowLayer *winBorder,
|
|
|
|
WindowLayer *toWindowLayer);
|
|
|
|
void RemoveWindowLayerFromSubset(WindowLayer *winBorder,
|
|
|
|
WindowLayer *fromWindowLayer);
|
2004-07-07 00:51:16 +04:00
|
|
|
|
2005-11-24 20:45:26 +03:00
|
|
|
WindowLayer* FindWindowLayerByClientToken(int32 token, team_id teamID);
|
|
|
|
//WindowLayer* FindWindowLayerByServerToken(int32 token);
|
2005-07-05 22:14:24 +04:00
|
|
|
|
2005-10-31 22:35:46 +03:00
|
|
|
// get list of registed windows
|
2005-11-24 20:45:26 +03:00
|
|
|
const BObjectList<WindowLayer>& WindowList() const;
|
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:
|
2005-10-31 22:35:46 +03:00
|
|
|
status_t _ActivateApp(team_id team);
|
2005-07-24 21:14:17 +04:00
|
|
|
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-10-31 22:35:46 +03:00
|
|
|
uid_t fUserID;
|
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;
|
* the new input event dispatcher is now actually used, although it doesn't
distribute any messages to the clients yet.
* removed the working thread from RootLayer - for now, its event handlers are
still called using input filters in the new event dispatcher, though (to
get things started).
* ServerApp is now using a BMessenger to identify its client, and no longer
stores the port/token separately.
* the input_server handshake is a bit simpler now, as it can now just reply
to the app_server message, removed unused code from ServerProtocol.h
* calmed down the MultiLocker (it always printed thread statistics on startup,
because it's compiled in debug mode).
* removed the cursor thread stuff from AppServer.cpp
* the new event dispatcher now uses a cursor thread when supported (only in
native mode, not in the test environment), although it improves cursor
movement under Qemu, the effect is not as good as expected - this might
need some more investigations (might just be a thread priority problem).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15012 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-18 14:30:06 +03:00
|
|
|
::EventDispatcher fEventDispatcher;
|
2005-11-15 22:59:53 +03:00
|
|
|
port_id fInputPort;
|
2005-07-26 01:08:34 +04:00
|
|
|
|
|
|
|
BLocker fAppListLock;
|
|
|
|
BList fAppList;
|
|
|
|
|
|
|
|
sem_id fShutdownSemaphore;
|
|
|
|
int32 fShutdownCount;
|
|
|
|
|
2005-11-24 20:45:26 +03:00
|
|
|
BObjectList<WindowLayer> fWindowLayerList;
|
2005-07-15 16:45:23 +04:00
|
|
|
|
2005-11-18 16:51:32 +03: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_
|