Cursor operations are made through RootLayer's(ATM, the only one) CursorManager and visible settings directly call RootLayer's DisplayDriver.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10887 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2005-01-19 18:00:05 +00:00
parent 3b5df3c151
commit aea21365e7
2 changed files with 49 additions and 28 deletions
+45 -23
View File
@@ -113,8 +113,11 @@ ServerApp::ServerApp(port_id sendport, port_id rcvport, port_id clientLooperPort
fIsActive=false; fIsActive=false;
fSharedMem=new AreaPool; fSharedMem=new AreaPool;
ServerCursor *defaultc=cursormanager->GetCursor(B_CURSOR_DEFAULT); // 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 *defaultc=desktop->ActiveRootLayer()->GetCursorManager().GetCursor(B_CURSOR_DEFAULT);
fAppCursor=(defaultc)?new ServerCursor(defaultc):NULL; fAppCursor=(defaultc)?new ServerCursor(defaultc):NULL;
fAppCursor->SetOwningTeam(fClientTeamID); fAppCursor->SetOwningTeam(fClientTeamID);
@@ -169,7 +172,10 @@ ServerApp::~ServerApp(void)
// if(fAppCursor) // if(fAppCursor)
// delete fAppCursor; // delete fAppCursor;
cursormanager->RemoveAppCursors(fClientTeamID); // 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.
desktop->ActiveRootLayer()->GetCursorManager().RemoveAppCursors(fClientTeamID);
delete_sem(fLockSem); delete_sem(fLockSem);
STRACE(("#ServerApp %s:~ServerApp()\n",fSignature.String())); STRACE(("#ServerApp %s:~ServerApp()\n",fSignature.String()));
@@ -278,13 +284,11 @@ void ServerApp::Activate(bool value)
//! Sets the cursor to the application cursor, if any. //! Sets the cursor to the application cursor, if any.
void ServerApp::SetAppCursor(void) void ServerApp::SetAppCursor(void)
{ {
debugger("ServerApp::SetAppCursor() not yet available\n"); // 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)
cursormanager->SetCursor(fAppCursor->ID()); desktop->ActiveRootLayer()->GetDisplayDriver()->SetCursor(fAppCursor);
else
cursormanager->SetCursor(B_CURSOR_DEFAULT);
*/
} }
/*! /*!
@@ -767,24 +771,30 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
case AS_SHOW_CURSOR: case AS_SHOW_CURSOR:
{ {
STRACE(("ServerApp %s: Show Cursor\n",fSignature.String())); STRACE(("ServerApp %s: Show Cursor\n",fSignature.String()));
printf("AS_SHOW_CURSOR: not yet available\n"); // although this isn't pretty, ATM we have only one RootLayer.
// cursormanager->ShowCursor(); // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify.
desktop->ActiveRootLayer()->GetDisplayDriver()->ShowCursor();
fCursorHidden=false; fCursorHidden=false;
break; break;
} }
case AS_HIDE_CURSOR: case AS_HIDE_CURSOR:
{ {
STRACE(("ServerApp %s: Hide Cursor\n",fSignature.String())); STRACE(("ServerApp %s: Hide Cursor\n",fSignature.String()));
printf("AS_HIDE_CURSOR: not yet available\n"); // although this isn't pretty, ATM we have only one RootLayer.
// cursormanager->HideCursor(); // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify.
desktop->ActiveRootLayer()->GetDisplayDriver()->HideCursor();
fCursorHidden=true; fCursorHidden=true;
break; break;
} }
case AS_OBSCURE_CURSOR: case AS_OBSCURE_CURSOR:
{ {
STRACE(("ServerApp %s: Obscure Cursor\n",fSignature.String())); STRACE(("ServerApp %s: Obscure Cursor\n",fSignature.String()));
printf("AS_OBSCURE_CURSOR: not yet available\n"); // although this isn't pretty, ATM we have only one RootLayer.
// cursormanager->ObscureCursor(); // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify.
desktop->ActiveRootLayer()->GetDisplayDriver()->ObscureCursor();
break; break;
} }
case AS_QUERY_CURSOR_HIDDEN: case AS_QUERY_CURSOR_HIDDEN:
@@ -813,14 +823,16 @@ printf("AS_OBSCURE_CURSOR: not yet available\n");
// 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)
cursormanager->DeleteCursor(fAppCursor->ID()); desktop->ActiveRootLayer()->GetCursorManager().DeleteCursor(fAppCursor->ID());
fAppCursor=new ServerCursor(cdata); fAppCursor=new ServerCursor(cdata);
fAppCursor->SetOwningTeam(fClientTeamID); fAppCursor->SetOwningTeam(fClientTeamID);
fAppCursor->SetAppSignature(fSignature.String()); fAppCursor->SetAppSignature(fSignature.String());
cursormanager->AddCursor(fAppCursor); desktop->ActiveRootLayer()->GetCursorManager().AddCursor(fAppCursor);
printf("AS_SET_CURSOR_DATA: not yet available\n"); // although this isn't pretty, ATM we have only one RootLayer.
// cursormanager->SetCursor(fAppCursor->ID()); // there should be a way that this ServerApp be attached to a particular
// RootLayer to know which RootLayer's cursor to modify.
desktop->ActiveRootLayer()->GetDisplayDriver()->SetCursor(fAppCursor);
break; break;
} }
case AS_SET_CURSOR_BCURSOR: case AS_SET_CURSOR_BCURSOR:
@@ -839,8 +851,12 @@ printf("AS_SET_CURSOR_DATA: not yet available\n");
if(sync) if(sync)
msg.Read<int32>(&replyport); msg.Read<int32>(&replyport);
printf("AS_SET_CURSOR_BCURSOR: not yet available\n"); // although this isn't pretty, ATM we have only one RootLayer.
// cursormanager->SetCursor(ctoken); // 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 = desktop->ActiveRootLayer()->GetCursorManager().FindCursor(ctoken)))
desktop->ActiveRootLayer()->GetDisplayDriver()->SetCursor(cursor);
if(sync) if(sync)
{ {
@@ -868,7 +884,10 @@ printf("AS_SET_CURSOR_BCURSOR: not yet available\n");
fAppCursor=new ServerCursor(cdata); fAppCursor=new ServerCursor(cdata);
fAppCursor->SetOwningTeam(fClientTeamID); fAppCursor->SetOwningTeam(fClientTeamID);
fAppCursor->SetAppSignature(fSignature.String()); fAppCursor->SetAppSignature(fSignature.String());
cursormanager->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.
desktop->ActiveRootLayer()->GetCursorManager().AddCursor(fAppCursor);
// Synchronous message - BApplication is waiting on the cursor's ID // Synchronous message - BApplication is waiting on the cursor's ID
replylink.SetSendPort(replyport); replylink.SetSendPort(replyport);
@@ -888,7 +907,10 @@ printf("AS_SET_CURSOR_BCURSOR: not yet available\n");
if(fAppCursor && fAppCursor->ID()==ctoken) if(fAppCursor && fAppCursor->ID()==ctoken)
fAppCursor=NULL; fAppCursor=NULL;
cursormanager->DeleteCursor(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.
desktop->ActiveRootLayer()->GetCursorManager().DeleteCursor(ctoken);
break; break;
} }
case AS_GET_SCROLLBAR_INFO: case AS_GET_SCROLLBAR_INFO:
+4 -5
View File
@@ -50,7 +50,6 @@
#include "Utils.h" #include "Utils.h"
#include "DisplayDriver.h" #include "DisplayDriver.h"
#include "ServerPicture.h" #include "ServerPicture.h"
#include "CursorManager.h"
#include "Workspace.h" #include "Workspace.h"
//#define DEBUG_SERVERWINDOW //#define DEBUG_SERVERWINDOW
@@ -1020,14 +1019,14 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
} }
case AS_LAYER_CURSOR: case AS_LAYER_CURSOR:
{ {
DTRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: Layer: %s\n",fTitle.String(), cl->fName->String())); DTRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: Layer: %s - NOT IMPLEMENTED\n",fTitle.String(), cl->fName->String()));
int32 token; int32 token;
link.Read<int32>(&token); link.Read<int32>(&token);
printf("AS_LAYER_CURSOR: not yet available\n");
// cursormanager->SetCursor(token);
// TODO: implement; I think each Layer should have a member pointing
// to this requested cursor.
break; break;
} }
case AS_LAYER_SET_FLAGS: case AS_LAYER_SET_FLAGS: