* Removed ServerCursorReference in favour of BReference.

* Simplified the Desktop::SetCursor() code a bit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35471 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-02-15 14:43:09 +00:00
parent abf0b1523a
commit aeb689782c
4 changed files with 4 additions and 67 deletions

View File

@ -475,10 +475,6 @@ Desktop::SetCursor(ServerCursor* newCursor)
if (newCursor == NULL)
newCursor = fCursorManager.GetCursor(B_CURSOR_DEFAULT);
ServerCursorReference oldCursor = Cursor();
if (newCursor == oldCursor.Cursor())
return;
HWInterface()->SetCursor(newCursor);
}

View File

@ -65,66 +65,7 @@ private:
};
class ServerCursorReference {
public:
ServerCursorReference()
:
fCursor(NULL)
{
}
ServerCursorReference(ServerCursor* cursor)
:
fCursor(cursor)
{
if (fCursor)
fCursor->AcquireReference();
}
ServerCursorReference(const ServerCursorReference& other)
:
fCursor(other.fCursor)
{
if (fCursor)
fCursor->AcquireReference();
}
virtual ~ServerCursorReference()
{
if (fCursor)
fCursor->ReleaseReference();
}
ServerCursorReference& operator=(const ServerCursorReference& other)
{
SetCursor(other.fCursor);
return *this;
}
void SetCursor(ServerCursor* cursor)
{
if (fCursor == cursor)
return;
if (cursor)
cursor->AcquireReference();
ServerCursor* oldCursor = fCursor;
fCursor = cursor;
if (oldCursor)
oldCursor->ReleaseReference();
}
ServerCursor* Cursor() const
{
return fCursor;
}
private:
ServerCursor* fCursor;
};
typedef BReference<ServerCursor> ServerCursorReference;
#endif // SERVER_CURSOR_H

View File

@ -1380,7 +1380,7 @@ DrawingEngine::ReadBitmap(ServerBitmap* bitmap, bool drawCursor, BRect bounds)
if (drawCursor) {
ServerCursorReference cursorRef = fGraphicsCard->Cursor();
ServerCursor* cursor = cursorRef.Cursor();
ServerCursor* cursor = cursorRef.Get();
if (!cursor)
return result;
int32 cursorWidth = cursor->Width();

View File

@ -488,7 +488,7 @@ RemoteHWInterface::SetCursor(ServerCursor* cursor)
HWInterface::SetCursor(cursor);
RemoteMessage message(NULL, fSendBuffer);
message.Start(RP_SET_CURSOR);
message.AddCursor(Cursor().Cursor());
message.AddCursor(Cursor().Get());
}
@ -520,7 +520,7 @@ RemoteHWInterface::SetDragBitmap(const ServerBitmap* bitmap,
HWInterface::SetDragBitmap(bitmap, offsetFromCursor);
RemoteMessage message(NULL, fSendBuffer);
message.Start(RP_SET_CURSOR);
message.AddCursor(CursorAndDragBitmap().Cursor());
message.AddCursor(CursorAndDragBitmap().Get());
}