Moved the CursorManager over to the Desktop too.
Maybe the CursorManager should be used to set the cursors directly instead of using fDesktop->GetCursorManager.FindCursor() and then fDesktop->GetHWInterface()->SetCursor() in ServerApp.cpp. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14033 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
144a7af719
commit
3ddebe7ec2
|
@ -371,10 +371,7 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
|
|||
|
||||
case AS_SET_SYSCURSOR_DEFAULTS:
|
||||
{
|
||||
// although this isn't pretty, ATM we only have RootLayer.
|
||||
// this messages should be handled somewhere into a RootLayer
|
||||
// specific area - this set is intended for a RootLayer.
|
||||
gDesktop->ActiveRootLayer()->GetCursorManager().SetDefaults();
|
||||
gDesktop->GetCursorManager().SetDefaults();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,8 @@ Desktop::Desktop()
|
|||
fAppListLock("application list"),
|
||||
fShutdownSemaphore(-1),
|
||||
fWinBorderList(64),
|
||||
fActiveScreen(NULL)
|
||||
fActiveScreen(NULL),
|
||||
fCursorManager()
|
||||
{
|
||||
// TODO: use user name
|
||||
char name[B_OS_NAME_LENGTH];
|
||||
|
@ -104,7 +105,7 @@ Desktop::Init()
|
|||
fRootLayer->RunThread();
|
||||
|
||||
// take care of setting the default cursor
|
||||
ServerCursor *cursor = fRootLayer->GetCursorManager().GetCursor(B_CURSOR_DEFAULT);
|
||||
ServerCursor *cursor = fCursorManager.GetCursor(B_CURSOR_DEFAULT);
|
||||
if (cursor)
|
||||
fVirtualScreen.HWInterface()->SetCursor(cursor);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef _DESKTOP_H_
|
||||
#define _DESKTOP_H_
|
||||
|
||||
|
||||
#include "CursorManager.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "ServerScreen.h"
|
||||
#include "VirtualScreen.h"
|
||||
|
@ -54,6 +54,7 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||
inline Screen* ActiveScreen() const
|
||||
{ return fActiveScreen; }
|
||||
inline RootLayer* ActiveRootLayer() const { return fRootLayer; }
|
||||
inline CursorManager& GetCursorManager() { return fCursorManager; }
|
||||
|
||||
virtual void ScreenRemoved(Screen* screen) {}
|
||||
virtual void ScreenAdded(Screen* screen) {}
|
||||
|
@ -111,6 +112,8 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||
|
||||
RootLayer* fRootLayer;
|
||||
Screen* fActiveScreen;
|
||||
|
||||
CursorManager fCursorManager;
|
||||
};
|
||||
|
||||
extern Desktop *gDesktop;
|
||||
|
|
|
@ -81,8 +81,6 @@ RootLayer::RootLayer(const char *name, int32 workspaceCount,
|
|||
fViewAction(B_ENTERED_VIEW),
|
||||
fEventMaskLayer(NULL),
|
||||
|
||||
fCursorManager(),
|
||||
|
||||
fAllRegionsLock("root layer region lock"),
|
||||
|
||||
fThreadID(B_ERROR),
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "DebugInfoManager.h"
|
||||
#include "Desktop.h"
|
||||
#include "Layer.h"
|
||||
#include "CursorManager.h"
|
||||
#include "Workspace.h"
|
||||
|
||||
class DisplayDriver;
|
||||
|
@ -121,8 +120,6 @@ public:
|
|||
|
||||
static int32 WorkingThread(void *data);
|
||||
|
||||
CursorManager& GetCursorManager() { return fCursorManager; }
|
||||
|
||||
// Other methods
|
||||
bool Lock() { return fAllRegionsLock.Lock(); }
|
||||
void Unlock() { fAllRegionsLock.Unlock(); }
|
||||
|
@ -180,8 +177,6 @@ friend class Desktop;
|
|||
int32 fViewAction;
|
||||
Layer* fEventMaskLayer;
|
||||
|
||||
CursorManager fCursorManager;
|
||||
|
||||
BLocker fAllRegionsLock;
|
||||
|
||||
thread_id fThreadID;
|
||||
|
|
|
@ -118,11 +118,8 @@ ServerApp::ServerApp(Desktop* desktop, port_id clientReplyPort,
|
|||
return;
|
||||
}
|
||||
|
||||
// although this isn't pretty, ATM we have only one RootLayer.
|
||||
// there should be a way that this ServerApp be attached to a particular
|
||||
// RootLayer to know which RootLayer's cursor to modify.
|
||||
ServerCursor *defaultCursor =
|
||||
fDesktop->ActiveRootLayer()->GetCursorManager().GetCursor(B_CURSOR_DEFAULT);
|
||||
fDesktop->GetCursorManager().GetCursor(B_CURSOR_DEFAULT);
|
||||
|
||||
if (defaultCursor) {
|
||||
fAppCursor = new ServerCursor(defaultCursor);
|
||||
|
@ -199,10 +196,7 @@ ServerApp::~ServerApp(void)
|
|||
delete (ServerPicture*)fPictureList.ItemAt(i);
|
||||
}
|
||||
|
||||
// although this isn't pretty, ATM we have only one RootLayer.
|
||||
// there should be a way that this ServerApp be attached to a particular
|
||||
// RootLayer to know which RootLayer's cursor to modify.
|
||||
fDesktop->ActiveRootLayer()->GetCursorManager().RemoveAppCursors(fClientTeam);
|
||||
fDesktop->GetCursorManager().RemoveAppCursors(fClientTeam);
|
||||
|
||||
STRACE(("ServerApp %s::~ServerApp(): Exiting\n", Signature()));
|
||||
}
|
||||
|
@ -308,9 +302,6 @@ ServerApp::Activate(bool value)
|
|||
void
|
||||
ServerApp::SetAppCursor(void)
|
||||
{
|
||||
// although this isn't pretty, ATM we have only one RootLayer.
|
||||
// there should be a way that this ServerApp be attached to a particular
|
||||
// RootLayer to know which RootLayer's cursor to modify.
|
||||
if (fAppCursor)
|
||||
fDesktop->GetHWInterface()->SetCursor(fAppCursor);
|
||||
}
|
||||
|
@ -928,15 +919,10 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||
break;
|
||||
}
|
||||
|
||||
// Theoretically, we could just call the driver directly, but we will
|
||||
// call the CursorManager's version to allow for future expansion
|
||||
case AS_SHOW_CURSOR:
|
||||
{
|
||||
STRACE(("ServerApp %s: Show Cursor\n", Signature()));
|
||||
// although this isn't pretty, ATM we have only one RootLayer.
|
||||
// there should be a way that this ServerApp be attached to a particular
|
||||
// RootLayer to know which RootLayer's cursor to modify.
|
||||
// TODO: support nested showing/hiding
|
||||
// TODO: support nested showing/hiding
|
||||
fDesktop->GetHWInterface()->SetCursorVisible(true);
|
||||
fCursorHidden = false;
|
||||
break;
|
||||
|
@ -944,10 +930,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||
case AS_HIDE_CURSOR:
|
||||
{
|
||||
STRACE(("ServerApp %s: Hide Cursor\n", Signature()));
|
||||
// although this isn't pretty, ATM we have only one RootLayer.
|
||||
// there should be a way that this ServerApp be attached to a particular
|
||||
// RootLayer to know which RootLayer's cursor to modify.
|
||||
// TODO: support nested showing/hiding
|
||||
// TODO: support nested showing/hiding
|
||||
fDesktop->GetHWInterface()->SetCursorVisible(false);
|
||||
fCursorHidden = true;
|
||||
break;
|
||||
|
@ -955,10 +938,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||
case AS_OBSCURE_CURSOR:
|
||||
{
|
||||
STRACE(("ServerApp %s: Obscure Cursor\n", Signature()));
|
||||
// although this isn't pretty, ATM we have only one RootLayer.
|
||||
// there should be a way that this ServerApp be attached to a particular
|
||||
// RootLayer to know which RootLayer's cursor to modify.
|
||||
// fDesktop->GetHWInterface()->ObscureCursor();
|
||||
// ToDo: Enable ObscureCursor
|
||||
//fDesktop->GetHWInterface()->ObscureCursor();
|
||||
break;
|
||||
}
|
||||
case AS_QUERY_CURSOR_HIDDEN:
|
||||
|
@ -981,15 +962,14 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||
// otherwise be easy to crash the server by calling SetCursor a
|
||||
// sufficient number of times
|
||||
if(fAppCursor)
|
||||
fDesktop->ActiveRootLayer()->GetCursorManager().DeleteCursor(fAppCursor->ID());
|
||||
fDesktop->GetCursorManager().DeleteCursor(fAppCursor->ID());
|
||||
|
||||
fAppCursor = new ServerCursor(cdata);
|
||||
fAppCursor->SetOwningTeam(fClientTeam);
|
||||
fAppCursor->SetAppSignature(Signature());
|
||||
fDesktop->ActiveRootLayer()->GetCursorManager().AddCursor(fAppCursor);
|
||||
// although this isn't pretty, ATM we have only one RootLayer.
|
||||
// there should be a way that this ServerApp be attached to a particular
|
||||
// RootLayer to know which RootLayer's cursor to modify.
|
||||
|
||||
// ToDo: These two should probably both be done in Desktop directly
|
||||
fDesktop->GetCursorManager().AddCursor(fAppCursor);
|
||||
fDesktop->GetHWInterface()->SetCursor(fAppCursor);
|
||||
break;
|
||||
}
|
||||
|
@ -1005,12 +985,9 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||
|
||||
link.Read<bool>(&sync);
|
||||
link.Read<int32>(&ctoken);
|
||||
|
||||
// although this isn't pretty, ATM we have only one RootLayer.
|
||||
// there should be a way that this ServerApp be attached to a particular
|
||||
// RootLayer to know which RootLayer's cursor to modify.
|
||||
ServerCursor *cursor;
|
||||
if ((cursor = fDesktop->ActiveRootLayer()->GetCursorManager().FindCursor(ctoken)))
|
||||
|
||||
ServerCursor *cursor = fDesktop->GetCursorManager().FindCursor(ctoken);
|
||||
if (cursor)
|
||||
fDesktop->GetHWInterface()->SetCursor(cursor);
|
||||
|
||||
if (sync) {
|
||||
|
@ -1031,13 +1008,17 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||
int8 cursorData[68];
|
||||
link.Read(cursorData, sizeof(cursorData));
|
||||
|
||||
// Because we don't want an overaccumulation of these particular
|
||||
// cursors, we will delete them if there is an existing one. It would
|
||||
// otherwise be easy to crash the server by calling CreateCursor a
|
||||
// sufficient number of times
|
||||
if (fAppCursor)
|
||||
fDesktop->GetCursorManager().DeleteCursor(fAppCursor->ID());
|
||||
|
||||
fAppCursor = new ServerCursor(cursorData);
|
||||
fAppCursor->SetOwningTeam(fClientTeam);
|
||||
fAppCursor->SetAppSignature(Signature());
|
||||
// although this isn't pretty, ATM we have only one RootLayer.
|
||||
// there should be a way that this ServerApp be attached to a particular
|
||||
// RootLayer to know which RootLayer's cursor to modify.
|
||||
fDesktop->ActiveRootLayer()->GetCursorManager().AddCursor(fAppCursor);
|
||||
fDesktop->GetCursorManager().AddCursor(fAppCursor);
|
||||
|
||||
// Synchronous message - BApplication is waiting on the cursor's ID
|
||||
fLink.StartMessage(SERVER_TRUE);
|
||||
|
@ -1056,10 +1037,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||
if (fAppCursor && fAppCursor->ID() == ctoken)
|
||||
fAppCursor = NULL;
|
||||
|
||||
// although this isn't pretty, ATM we have only one RootLayer.
|
||||
// there should be a way that this ServerApp be attached to a particular
|
||||
// RootLayer to know which RootLayer's cursor to modify.
|
||||
fDesktop->ActiveRootLayer()->GetCursorManager().DeleteCursor(ctoken);
|
||||
fDesktop->GetCursorManager().DeleteCursor(ctoken);
|
||||
break;
|
||||
}
|
||||
case AS_GET_SCROLLBAR_INFO:
|
||||
|
|
Loading…
Reference in New Issue