* 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:
@@ -475,10 +475,6 @@ Desktop::SetCursor(ServerCursor* newCursor)
|
|||||||
if (newCursor == NULL)
|
if (newCursor == NULL)
|
||||||
newCursor = fCursorManager.GetCursor(B_CURSOR_DEFAULT);
|
newCursor = fCursorManager.GetCursor(B_CURSOR_DEFAULT);
|
||||||
|
|
||||||
ServerCursorReference oldCursor = Cursor();
|
|
||||||
if (newCursor == oldCursor.Cursor())
|
|
||||||
return;
|
|
||||||
|
|
||||||
HWInterface()->SetCursor(newCursor);
|
HWInterface()->SetCursor(newCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,66 +65,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ServerCursorReference {
|
typedef BReference<ServerCursor> 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;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // SERVER_CURSOR_H
|
#endif // SERVER_CURSOR_H
|
||||||
|
|||||||
@@ -1380,7 +1380,7 @@ DrawingEngine::ReadBitmap(ServerBitmap* bitmap, bool drawCursor, BRect bounds)
|
|||||||
|
|
||||||
if (drawCursor) {
|
if (drawCursor) {
|
||||||
ServerCursorReference cursorRef = fGraphicsCard->Cursor();
|
ServerCursorReference cursorRef = fGraphicsCard->Cursor();
|
||||||
ServerCursor* cursor = cursorRef.Cursor();
|
ServerCursor* cursor = cursorRef.Get();
|
||||||
if (!cursor)
|
if (!cursor)
|
||||||
return result;
|
return result;
|
||||||
int32 cursorWidth = cursor->Width();
|
int32 cursorWidth = cursor->Width();
|
||||||
|
|||||||
@@ -488,7 +488,7 @@ RemoteHWInterface::SetCursor(ServerCursor* cursor)
|
|||||||
HWInterface::SetCursor(cursor);
|
HWInterface::SetCursor(cursor);
|
||||||
RemoteMessage message(NULL, fSendBuffer);
|
RemoteMessage message(NULL, fSendBuffer);
|
||||||
message.Start(RP_SET_CURSOR);
|
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);
|
HWInterface::SetDragBitmap(bitmap, offsetFromCursor);
|
||||||
RemoteMessage message(NULL, fSendBuffer);
|
RemoteMessage message(NULL, fSendBuffer);
|
||||||
message.Start(RP_SET_CURSOR);
|
message.Start(RP_SET_CURSOR);
|
||||||
message.AddCursor(CursorAndDragBitmap().Cursor());
|
message.AddCursor(CursorAndDragBitmap().Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user