* The ServerApp now has the concept of a current cursor: this is either the cursor
of the view currently under the mouse, or the application cursor, if the view doesn't have its own cursor (ie. it will no longer set the wrong cursor in certain situations). * AS_DELETE_CURSOR has no longer an influence on the application cursor, as this grabs a ref for its own use - this fixes bug #275. * AS_SET_CURSOR no longer sets the cursor when the application is not active. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16678 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ed45b6652a
commit
9ce4e5b4ed
@ -91,6 +91,7 @@ ServerApp::ServerApp(Desktop* desktop, port_id clientReplyPort,
|
||||
fClientTeam(clientTeam),
|
||||
fWindowListLock("window list"),
|
||||
fAppCursor(NULL),
|
||||
fViewCursor(NULL),
|
||||
fCursorHideLevel(0),
|
||||
fIsActive(false),
|
||||
fSharedMem("shared memory", 32768)
|
||||
@ -281,17 +282,29 @@ ServerApp::Activate(bool value)
|
||||
|
||||
fIsActive = value;
|
||||
|
||||
if (fIsActive)
|
||||
SetCursor();
|
||||
if (fIsActive) {
|
||||
// Set the cursor to the application cursor, if any
|
||||
fDesktop->SetCursor(CurrentCursor());
|
||||
fDesktop->HWInterface()->SetCursorVisible(fCursorHideLevel == 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! Sets the cursor to the application cursor, if any.
|
||||
void
|
||||
ServerApp::SetCursor()
|
||||
ServerApp::SetCurrentCursor(ServerCursor* cursor)
|
||||
{
|
||||
fDesktop->SetCursor(fAppCursor);
|
||||
fDesktop->HWInterface()->SetCursorVisible(fCursorHideLevel == 0);
|
||||
fViewCursor = cursor;
|
||||
fDesktop->SetCursor(CurrentCursor());
|
||||
}
|
||||
|
||||
|
||||
ServerCursor*
|
||||
ServerApp::CurrentCursor() const
|
||||
{
|
||||
if (fViewCursor != NULL)
|
||||
return fViewCursor;
|
||||
|
||||
return fAppCursor;
|
||||
}
|
||||
|
||||
|
||||
@ -928,6 +941,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
||||
case AS_SET_CURSOR:
|
||||
{
|
||||
STRACE(("ServerApp %s: SetCursor\n", Signature()));
|
||||
|
||||
// Attached data:
|
||||
// 1) bool flag to send a reply
|
||||
// 2) int32 token ID of the cursor to set
|
||||
@ -941,13 +955,11 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
||||
|
||||
ServerCursor* oldCursor = fAppCursor;
|
||||
fAppCursor = fDesktop->GetCursorManager().FindCursor(token);
|
||||
if (fAppCursor != NULL) {
|
||||
if (fAppCursor != NULL)
|
||||
fAppCursor->Acquire();
|
||||
fDesktop->HWInterface()->SetCursor(fAppCursor);
|
||||
}
|
||||
|
||||
// TODO: This is wrong: We need to take view cursors into account here!
|
||||
fDesktop->SetCursor(fAppCursor);
|
||||
if (fIsActive)
|
||||
fDesktop->SetCursor(CurrentCursor());
|
||||
|
||||
if (oldCursor != NULL)
|
||||
oldCursor->Release();
|
||||
@ -1014,9 +1026,6 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
||||
if (link.Read<bool>(&pendingViewCursor) != B_OK)
|
||||
break;
|
||||
|
||||
if (fAppCursor && fAppCursor->Token() == token)
|
||||
fAppCursor = NULL;
|
||||
|
||||
ServerCursor* cursor = fDesktop->GetCursorManager().FindCursor(token);
|
||||
if (cursor) {
|
||||
if (pendingViewCursor)
|
||||
|
@ -61,8 +61,8 @@ class ServerApp : public MessageLooper {
|
||||
|
||||
void SendMessageToClient(BMessage* message) const;
|
||||
|
||||
void SetCursor();
|
||||
ServerCursor* Cursor() const { return fAppCursor; }
|
||||
void SetCurrentCursor(ServerCursor* cursor);
|
||||
ServerCursor* CurrentCursor() const;
|
||||
|
||||
team_id ClientTeam() const;
|
||||
const char* Signature() const { return fSignature.String(); }
|
||||
@ -74,16 +74,16 @@ class ServerApp : public MessageLooper {
|
||||
|
||||
int32 CountBitmaps() const;
|
||||
ServerBitmap* FindBitmap(int32 token) const;
|
||||
|
||||
|
||||
int32 CountPictures() const;
|
||||
ServerPicture* CreatePicture(const ServerPicture* original = NULL);
|
||||
ServerPicture* FindPicture(const int32& token) const;
|
||||
bool DeletePicture(const int32& token);
|
||||
|
||||
|
||||
AreaPool* AppAreaPool() { return &fSharedMem; }
|
||||
|
||||
|
||||
Desktop* GetDesktop() const { return fDesktop; }
|
||||
|
||||
|
||||
BPrivate::BTokenSpace& ViewTokens() { return fViewTokens; }
|
||||
|
||||
private:
|
||||
@ -123,6 +123,7 @@ class ServerApp : public MessageLooper {
|
||||
BList fPictureList;
|
||||
|
||||
ServerCursor* fAppCursor;
|
||||
ServerCursor* fViewCursor;
|
||||
int32 fCursorHideLevel;
|
||||
// 0 = cursor visible
|
||||
|
||||
|
@ -590,7 +590,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
}
|
||||
case AS_SEND_BEHIND:
|
||||
{
|
||||
STRACE(("ServerWindow %s: Message Send_Behind unimplemented\n", Title()));
|
||||
STRACE(("ServerWindow %s: Message AS_SEND_BEHIND\n", Title()));
|
||||
int32 token;
|
||||
team_id teamID;
|
||||
status_t status;
|
||||
@ -650,7 +650,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
}
|
||||
case AS_NEEDS_UPDATE:
|
||||
{
|
||||
STRACE(("ServerWindow %s: Message Needs_Update unimplemented\n", Title()));
|
||||
STRACE(("ServerWindow %s: Message AS_NEEDS_UPDATE\n", Title()));
|
||||
if (fWindowLayer->NeedsUpdate())
|
||||
fLink.StartMessage(B_OK);
|
||||
else
|
||||
@ -1240,7 +1240,9 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
||||
}
|
||||
case AS_LAYER_SET_CURSOR:
|
||||
{
|
||||
DTRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: ViewLayer: %s - NOT IMPLEMENTED\n", Title(), fCurrentLayer->Name()));
|
||||
DTRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: ViewLayer: %s\n", Title(),
|
||||
fCurrentLayer->Name()));
|
||||
|
||||
int32 token;
|
||||
if (link.Read<int32>(&token) != B_OK)
|
||||
break;
|
||||
@ -1253,7 +1255,7 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
||||
fDesktop->UnlockSingleWindow();
|
||||
|
||||
if (fDesktop->EventDispatcher().ViewUnderMouse(fEventTarget) == fCurrentLayer->Token())
|
||||
fDesktop->SetCursor(cursor);
|
||||
fServerApp->SetCurrentCursor(cursor);
|
||||
|
||||
fDesktop->LockSingleWindow();
|
||||
}
|
||||
|
@ -990,12 +990,7 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken,
|
||||
if (IsFocus()) {
|
||||
// TODO: there is more for real cursor support, ie. if a window is closed,
|
||||
// new app cursor shouldn't override view cursor, ...
|
||||
ServerCursor* cursor = ServerWindow()->App()->Cursor();
|
||||
|
||||
if (view != NULL && view->Cursor() != NULL)
|
||||
cursor = view->Cursor();
|
||||
|
||||
fDesktop->SetCursor(cursor);
|
||||
ServerWindow()->App()->SetCurrentCursor(view != NULL ? view->Cursor() : NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user