various changes to handling custom cursors:
* all cursors owned by a team are visually different, or (iaw) an already existing cursor is reused when it is set by the client again * changed various occurances of cursor data from "int8*" to "uint8*" * ServerCursors also remember the R5 data from which they were created * the reference counting and destruction of ServerCursors changed: The cursor knows it is attached to a CursorManager and one can simply use ServerCursor::Acquire() and Release() and the reference counting and everything is being taken care of * destroying a ViewLayer will now correctly release a set ServerCursor * fixed a race condition when setting a cursor through BView::SetViewCursor(): If the client code looks like this: BCursor cursor(cursorData); someView->SetViewCursor(&cursor, false); there is a relatively high chance the BCursor destructor told the ServerApp thread to destroy the cursor before the ServerWindow thread got to "acquire" the cursor for use by the view layer. The very same problem is likely the reason that SetViewCursor works to unreliably on R5, even when the "sync" flag is set to "true" (although it should theoretically work in that case). all these fixes make WonderBrush work fine again with the new support of custom cursors.... coded by axeld and myself (the joys of pair programming :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16521 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -33,6 +33,7 @@ class BCursor : BArchivable {
|
||||
|
||||
int32 fServerToken;
|
||||
bool fNeedToFree;
|
||||
mutable bool fPendingViewCursor;
|
||||
|
||||
uint32 _reserved[6];
|
||||
};
|
||||
|
||||
@@ -42,7 +42,7 @@ class CursorSet : public BMessage {
|
||||
status_t Save(const char *path,int32 saveflags=0);
|
||||
status_t Load(const char *path);
|
||||
status_t AddCursor(cursor_which which,const BBitmap *cursor, const BPoint &hotspot);
|
||||
status_t AddCursor(cursor_which which, int8 *data);
|
||||
status_t AddCursor(cursor_which which, uint8 *data);
|
||||
void RemoveCursor(cursor_which which);
|
||||
status_t FindCursor(cursor_which which, BBitmap **cursor, BPoint *hotspot);
|
||||
status_t FindCursor(cursor_which which, ServerCursor **cursor);
|
||||
@@ -51,7 +51,7 @@ class CursorSet : public BMessage {
|
||||
|
||||
private:
|
||||
const char *_CursorWhichToString(cursor_which which);
|
||||
BBitmap *_CursorDataToBitmap(int8 *data);
|
||||
BBitmap *_CursorDataToBitmap(uint8 *data);
|
||||
};
|
||||
|
||||
#endif // CURSOR_SET_H
|
||||
|
||||
@@ -26,7 +26,7 @@ class ServerCursor : public ServerBitmap {
|
||||
int32 flags, BPoint hotspot,
|
||||
int32 bytesperrow = -1,
|
||||
screen_id screen = B_MAIN_SCREEN_ID);
|
||||
ServerCursor(const int8* cursorDataFromR5);
|
||||
ServerCursor(const uint8* cursorDataFromR5);
|
||||
ServerCursor(const uint8* alreadyPaddedData,
|
||||
uint32 width, uint32 height,
|
||||
color_space format);
|
||||
@@ -47,8 +47,16 @@ class ServerCursor : public ServerBitmap {
|
||||
int32 Token() const
|
||||
{ return fToken; }
|
||||
|
||||
void Acquire() { atomic_add(&fReferenceCount, 1); }
|
||||
bool Release() { return atomic_add(&fReferenceCount, -1) == 1; }
|
||||
void Acquire()
|
||||
{ atomic_add(&fReferenceCount, 1); }
|
||||
bool Release();
|
||||
|
||||
void SetPendingViewCursor(bool pending);
|
||||
|
||||
void AttachedToManager(CursorManager* manager);
|
||||
|
||||
const uint8* CursorData() const
|
||||
{ return fCursorData; }
|
||||
|
||||
private:
|
||||
friend class CursorManager;
|
||||
@@ -56,6 +64,9 @@ class ServerCursor : public ServerBitmap {
|
||||
BPoint fHotSpot;
|
||||
team_id fOwningTeam;
|
||||
int32 fReferenceCount;
|
||||
uint8* fCursorData;
|
||||
CursorManager* fManager;
|
||||
vint32 fPendingViewCursor;
|
||||
};
|
||||
|
||||
#endif // SERVER_CURSOR_H
|
||||
|
||||
Reference in New Issue
Block a user