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:
@@ -371,10 +371,7 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
|
|||||||
|
|
||||||
case AS_SET_SYSCURSOR_DEFAULTS:
|
case AS_SET_SYSCURSOR_DEFAULTS:
|
||||||
{
|
{
|
||||||
// although this isn't pretty, ATM we only have RootLayer.
|
gDesktop->GetCursorManager().SetDefaults();
|
||||||
// this messages should be handled somewhere into a RootLayer
|
|
||||||
// specific area - this set is intended for a RootLayer.
|
|
||||||
gDesktop->ActiveRootLayer()->GetCursorManager().SetDefaults();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ Desktop::Desktop()
|
|||||||
fAppListLock("application list"),
|
fAppListLock("application list"),
|
||||||
fShutdownSemaphore(-1),
|
fShutdownSemaphore(-1),
|
||||||
fWinBorderList(64),
|
fWinBorderList(64),
|
||||||
fActiveScreen(NULL)
|
fActiveScreen(NULL),
|
||||||
|
fCursorManager()
|
||||||
{
|
{
|
||||||
// TODO: use user name
|
// TODO: use user name
|
||||||
char name[B_OS_NAME_LENGTH];
|
char name[B_OS_NAME_LENGTH];
|
||||||
@@ -104,7 +105,7 @@ Desktop::Init()
|
|||||||
fRootLayer->RunThread();
|
fRootLayer->RunThread();
|
||||||
|
|
||||||
// take care of setting the default cursor
|
// take care of setting the default cursor
|
||||||
ServerCursor *cursor = fRootLayer->GetCursorManager().GetCursor(B_CURSOR_DEFAULT);
|
ServerCursor *cursor = fCursorManager.GetCursor(B_CURSOR_DEFAULT);
|
||||||
if (cursor)
|
if (cursor)
|
||||||
fVirtualScreen.HWInterface()->SetCursor(cursor);
|
fVirtualScreen.HWInterface()->SetCursor(cursor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#ifndef _DESKTOP_H_
|
#ifndef _DESKTOP_H_
|
||||||
#define _DESKTOP_H_
|
#define _DESKTOP_H_
|
||||||
|
|
||||||
|
#include "CursorManager.h"
|
||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
#include "ServerScreen.h"
|
#include "ServerScreen.h"
|
||||||
#include "VirtualScreen.h"
|
#include "VirtualScreen.h"
|
||||||
@@ -54,6 +54,7 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
inline Screen* ActiveScreen() const
|
inline Screen* ActiveScreen() const
|
||||||
{ return fActiveScreen; }
|
{ return fActiveScreen; }
|
||||||
inline RootLayer* ActiveRootLayer() const { return fRootLayer; }
|
inline RootLayer* ActiveRootLayer() const { return fRootLayer; }
|
||||||
|
inline CursorManager& GetCursorManager() { return fCursorManager; }
|
||||||
|
|
||||||
virtual void ScreenRemoved(Screen* screen) {}
|
virtual void ScreenRemoved(Screen* screen) {}
|
||||||
virtual void ScreenAdded(Screen* screen) {}
|
virtual void ScreenAdded(Screen* screen) {}
|
||||||
@@ -111,6 +112,8 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
|
|
||||||
RootLayer* fRootLayer;
|
RootLayer* fRootLayer;
|
||||||
Screen* fActiveScreen;
|
Screen* fActiveScreen;
|
||||||
|
|
||||||
|
CursorManager fCursorManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Desktop *gDesktop;
|
extern Desktop *gDesktop;
|
||||||
|
|||||||
@@ -81,8 +81,6 @@ RootLayer::RootLayer(const char *name, int32 workspaceCount,
|
|||||||
fViewAction(B_ENTERED_VIEW),
|
fViewAction(B_ENTERED_VIEW),
|
||||||
fEventMaskLayer(NULL),
|
fEventMaskLayer(NULL),
|
||||||
|
|
||||||
fCursorManager(),
|
|
||||||
|
|
||||||
fAllRegionsLock("root layer region lock"),
|
fAllRegionsLock("root layer region lock"),
|
||||||
|
|
||||||
fThreadID(B_ERROR),
|
fThreadID(B_ERROR),
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
#include "DebugInfoManager.h"
|
#include "DebugInfoManager.h"
|
||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
#include "CursorManager.h"
|
|
||||||
#include "Workspace.h"
|
#include "Workspace.h"
|
||||||
|
|
||||||
class DisplayDriver;
|
class DisplayDriver;
|
||||||
@@ -121,8 +120,6 @@ public:
|
|||||||
|
|
||||||
static int32 WorkingThread(void *data);
|
static int32 WorkingThread(void *data);
|
||||||
|
|
||||||
CursorManager& GetCursorManager() { return fCursorManager; }
|
|
||||||
|
|
||||||
// Other methods
|
// Other methods
|
||||||
bool Lock() { return fAllRegionsLock.Lock(); }
|
bool Lock() { return fAllRegionsLock.Lock(); }
|
||||||
void Unlock() { fAllRegionsLock.Unlock(); }
|
void Unlock() { fAllRegionsLock.Unlock(); }
|
||||||
@@ -180,8 +177,6 @@ friend class Desktop;
|
|||||||
int32 fViewAction;
|
int32 fViewAction;
|
||||||
Layer* fEventMaskLayer;
|
Layer* fEventMaskLayer;
|
||||||
|
|
||||||
CursorManager fCursorManager;
|
|
||||||
|
|
||||||
BLocker fAllRegionsLock;
|
BLocker fAllRegionsLock;
|
||||||
|
|
||||||
thread_id fThreadID;
|
thread_id fThreadID;
|
||||||
|
|||||||
@@ -118,11 +118,8 @@ ServerApp::ServerApp(Desktop* desktop, port_id clientReplyPort,
|
|||||||
return;
|
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 =
|
ServerCursor *defaultCursor =
|
||||||
fDesktop->ActiveRootLayer()->GetCursorManager().GetCursor(B_CURSOR_DEFAULT);
|
fDesktop->GetCursorManager().GetCursor(B_CURSOR_DEFAULT);
|
||||||
|
|
||||||
if (defaultCursor) {
|
if (defaultCursor) {
|
||||||
fAppCursor = new ServerCursor(defaultCursor);
|
fAppCursor = new ServerCursor(defaultCursor);
|
||||||
@@ -199,10 +196,7 @@ ServerApp::~ServerApp(void)
|
|||||||
delete (ServerPicture*)fPictureList.ItemAt(i);
|
delete (ServerPicture*)fPictureList.ItemAt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// although this isn't pretty, ATM we have only one RootLayer.
|
fDesktop->GetCursorManager().RemoveAppCursors(fClientTeam);
|
||||||
// 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);
|
|
||||||
|
|
||||||
STRACE(("ServerApp %s::~ServerApp(): Exiting\n", Signature()));
|
STRACE(("ServerApp %s::~ServerApp(): Exiting\n", Signature()));
|
||||||
}
|
}
|
||||||
@@ -308,9 +302,6 @@ ServerApp::Activate(bool value)
|
|||||||
void
|
void
|
||||||
ServerApp::SetAppCursor(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)
|
if (fAppCursor)
|
||||||
fDesktop->GetHWInterface()->SetCursor(fAppCursor);
|
fDesktop->GetHWInterface()->SetCursor(fAppCursor);
|
||||||
}
|
}
|
||||||
@@ -928,15 +919,10 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
break;
|
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:
|
case AS_SHOW_CURSOR:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Show Cursor\n", Signature()));
|
STRACE(("ServerApp %s: Show Cursor\n", Signature()));
|
||||||
// although this isn't pretty, ATM we have only one RootLayer.
|
// TODO: support nested showing/hiding
|
||||||
// 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
|
|
||||||
fDesktop->GetHWInterface()->SetCursorVisible(true);
|
fDesktop->GetHWInterface()->SetCursorVisible(true);
|
||||||
fCursorHidden = false;
|
fCursorHidden = false;
|
||||||
break;
|
break;
|
||||||
@@ -944,10 +930,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
case AS_HIDE_CURSOR:
|
case AS_HIDE_CURSOR:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Hide Cursor\n", Signature()));
|
STRACE(("ServerApp %s: Hide Cursor\n", Signature()));
|
||||||
// although this isn't pretty, ATM we have only one RootLayer.
|
// TODO: support nested showing/hiding
|
||||||
// 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
|
|
||||||
fDesktop->GetHWInterface()->SetCursorVisible(false);
|
fDesktop->GetHWInterface()->SetCursorVisible(false);
|
||||||
fCursorHidden = true;
|
fCursorHidden = true;
|
||||||
break;
|
break;
|
||||||
@@ -955,10 +938,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
case AS_OBSCURE_CURSOR:
|
case AS_OBSCURE_CURSOR:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Obscure Cursor\n", Signature()));
|
STRACE(("ServerApp %s: Obscure Cursor\n", Signature()));
|
||||||
// although this isn't pretty, ATM we have only one RootLayer.
|
// ToDo: Enable ObscureCursor
|
||||||
// there should be a way that this ServerApp be attached to a particular
|
//fDesktop->GetHWInterface()->ObscureCursor();
|
||||||
// RootLayer to know which RootLayer's cursor to modify.
|
|
||||||
// fDesktop->GetHWInterface()->ObscureCursor();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_QUERY_CURSOR_HIDDEN:
|
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
|
// otherwise be easy to crash the server by calling SetCursor a
|
||||||
// sufficient number of times
|
// sufficient number of times
|
||||||
if(fAppCursor)
|
if(fAppCursor)
|
||||||
fDesktop->ActiveRootLayer()->GetCursorManager().DeleteCursor(fAppCursor->ID());
|
fDesktop->GetCursorManager().DeleteCursor(fAppCursor->ID());
|
||||||
|
|
||||||
fAppCursor = new ServerCursor(cdata);
|
fAppCursor = new ServerCursor(cdata);
|
||||||
fAppCursor->SetOwningTeam(fClientTeam);
|
fAppCursor->SetOwningTeam(fClientTeam);
|
||||||
fAppCursor->SetAppSignature(Signature());
|
fAppCursor->SetAppSignature(Signature());
|
||||||
fDesktop->ActiveRootLayer()->GetCursorManager().AddCursor(fAppCursor);
|
|
||||||
// although this isn't pretty, ATM we have only one RootLayer.
|
// ToDo: These two should probably both be done in Desktop directly
|
||||||
// there should be a way that this ServerApp be attached to a particular
|
fDesktop->GetCursorManager().AddCursor(fAppCursor);
|
||||||
// RootLayer to know which RootLayer's cursor to modify.
|
|
||||||
fDesktop->GetHWInterface()->SetCursor(fAppCursor);
|
fDesktop->GetHWInterface()->SetCursor(fAppCursor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1006,11 +986,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
link.Read<bool>(&sync);
|
link.Read<bool>(&sync);
|
||||||
link.Read<int32>(&ctoken);
|
link.Read<int32>(&ctoken);
|
||||||
|
|
||||||
// although this isn't pretty, ATM we have only one RootLayer.
|
ServerCursor *cursor = fDesktop->GetCursorManager().FindCursor(ctoken);
|
||||||
// there should be a way that this ServerApp be attached to a particular
|
if (cursor)
|
||||||
// RootLayer to know which RootLayer's cursor to modify.
|
|
||||||
ServerCursor *cursor;
|
|
||||||
if ((cursor = fDesktop->ActiveRootLayer()->GetCursorManager().FindCursor(ctoken)))
|
|
||||||
fDesktop->GetHWInterface()->SetCursor(cursor);
|
fDesktop->GetHWInterface()->SetCursor(cursor);
|
||||||
|
|
||||||
if (sync) {
|
if (sync) {
|
||||||
@@ -1031,13 +1008,17 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
int8 cursorData[68];
|
int8 cursorData[68];
|
||||||
link.Read(cursorData, sizeof(cursorData));
|
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 = new ServerCursor(cursorData);
|
||||||
fAppCursor->SetOwningTeam(fClientTeam);
|
fAppCursor->SetOwningTeam(fClientTeam);
|
||||||
fAppCursor->SetAppSignature(Signature());
|
fAppCursor->SetAppSignature(Signature());
|
||||||
// although this isn't pretty, ATM we have only one RootLayer.
|
fDesktop->GetCursorManager().AddCursor(fAppCursor);
|
||||||
// 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);
|
|
||||||
|
|
||||||
// Synchronous message - BApplication is waiting on the cursor's ID
|
// Synchronous message - BApplication is waiting on the cursor's ID
|
||||||
fLink.StartMessage(SERVER_TRUE);
|
fLink.StartMessage(SERVER_TRUE);
|
||||||
@@ -1056,10 +1037,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
if (fAppCursor && fAppCursor->ID() == ctoken)
|
if (fAppCursor && fAppCursor->ID() == ctoken)
|
||||||
fAppCursor = NULL;
|
fAppCursor = NULL;
|
||||||
|
|
||||||
// although this isn't pretty, ATM we have only one RootLayer.
|
fDesktop->GetCursorManager().DeleteCursor(ctoken);
|
||||||
// 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);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_GET_SCROLLBAR_INFO:
|
case AS_GET_SCROLLBAR_INFO:
|
||||||
|
|||||||
Reference in New Issue
Block a user