588259b66d
* 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
73 lines
1.6 KiB
C++
73 lines
1.6 KiB
C++
/*
|
|
* Copyright 2001-2006, Haiku.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Authors:
|
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
*/
|
|
#ifndef SERVER_CURSOR_H
|
|
#define SERVER_CURSOR_H
|
|
|
|
|
|
#include "ServerBitmap.h"
|
|
|
|
#include <Point.h>
|
|
#include <String.h>
|
|
|
|
class ServerApp;
|
|
class CursorManager;
|
|
|
|
|
|
class ServerCursor : public ServerBitmap {
|
|
public:
|
|
ServerCursor(BRect r, color_space space,
|
|
int32 flags, BPoint hotspot,
|
|
int32 bytesperrow = -1,
|
|
screen_id screen = B_MAIN_SCREEN_ID);
|
|
ServerCursor(const uint8* cursorDataFromR5);
|
|
ServerCursor(const uint8* alreadyPaddedData,
|
|
uint32 width, uint32 height,
|
|
color_space format);
|
|
ServerCursor(const ServerCursor* cursor);
|
|
|
|
virtual ~ServerCursor();
|
|
|
|
//! Returns the cursor's hot spot
|
|
void SetHotSpot(BPoint pt);
|
|
BPoint GetHotSpot() const
|
|
{ return fHotSpot; }
|
|
|
|
void SetOwningTeam(team_id tid)
|
|
{ fOwningTeam = tid; }
|
|
team_id OwningTeam() const
|
|
{ return fOwningTeam; }
|
|
|
|
int32 Token() const
|
|
{ return fToken; }
|
|
|
|
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;
|
|
|
|
BPoint fHotSpot;
|
|
team_id fOwningTeam;
|
|
int32 fReferenceCount;
|
|
uint8* fCursorData;
|
|
CursorManager* fManager;
|
|
vint32 fPendingViewCursor;
|
|
};
|
|
|
|
#endif // SERVER_CURSOR_H
|