* Refactored ServerBitmap a bit: it now inherits from Referenceable instead of
roling its own solution. * Also removed BitmapManager::DeleteBitmap() - you only call ServerBitmap::RemoveReference(), and that one will notify the manager if needed. * Some more cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33878 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -201,18 +201,11 @@ BitmapManager::CreateBitmap(ClientMemoryAllocator* allocator,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Deletes a ServerBitmap.
|
/*! \brief Called when a ServerBitmap is deleted.
|
||||||
\param bitmap The bitmap to delete
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
BitmapManager::DeleteBitmap(ServerBitmap* bitmap)
|
BitmapManager::BitmapRemoved(ServerBitmap* bitmap)
|
||||||
{
|
{
|
||||||
if (bitmap == NULL || !bitmap->_Release()) {
|
|
||||||
// there are other references to this bitmap, we don't have to delete
|
|
||||||
// it yet
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BAutolock locker(fLock);
|
BAutolock locker(fLock);
|
||||||
if (!locker.IsLocked())
|
if (!locker.IsLocked())
|
||||||
return;
|
return;
|
||||||
@@ -220,11 +213,7 @@ BitmapManager::DeleteBitmap(ServerBitmap* bitmap)
|
|||||||
if (bitmap->Overlay() != NULL)
|
if (bitmap->Overlay() != NULL)
|
||||||
fOverlays.RemoveItem(bitmap);
|
fOverlays.RemoveItem(bitmap);
|
||||||
|
|
||||||
if (bitmap->Owner() != NULL)
|
fBitmapList.RemoveItem(bitmap);
|
||||||
bitmap->Owner()->BitmapRemoved(bitmap);
|
|
||||||
|
|
||||||
if (fBitmapList.RemoveItem(bitmap))
|
|
||||||
delete bitmap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ public:
|
|||||||
int32 bytesPerRow = -1,
|
int32 bytesPerRow = -1,
|
||||||
int32 screen = B_MAIN_SCREEN_ID.id,
|
int32 screen = B_MAIN_SCREEN_ID.id,
|
||||||
uint8* _allocationFlags = NULL);
|
uint8* _allocationFlags = NULL);
|
||||||
void DeleteBitmap(ServerBitmap* bitmap);
|
|
||||||
|
void BitmapRemoved(ServerBitmap* bitmap);
|
||||||
|
|
||||||
void SuspendOverlays();
|
void SuspendOverlays();
|
||||||
void ResumeOverlays();
|
void ResumeOverlays();
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2006, Haiku.
|
* Copyright 2001-2009, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* DarkWyrm <[email protected]>
|
* DarkWyrm <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Handles the system's cursor infrastructure */
|
|
||||||
|
/*! Handles the system's cursor infrastructure */
|
||||||
|
|
||||||
|
|
||||||
#include "CursorManager.h"
|
#include "CursorManager.h"
|
||||||
|
|
||||||
@@ -25,7 +27,8 @@
|
|||||||
|
|
||||||
|
|
||||||
CursorManager::CursorManager()
|
CursorManager::CursorManager()
|
||||||
: BLocker("CursorManager")
|
:
|
||||||
|
BLocker("CursorManager")
|
||||||
{
|
{
|
||||||
// Set system cursors to "unassigned"
|
// Set system cursors to "unassigned"
|
||||||
// ToDo: decide about default cursor
|
// ToDo: decide about default cursor
|
||||||
@@ -74,6 +77,7 @@ CursorManager::~CursorManager()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ServerCursor*
|
ServerCursor*
|
||||||
CursorManager::CreateCursor(team_id clientTeam, const uint8* cursorData)
|
CursorManager::CreateCursor(team_id clientTeam, const uint8* cursorData)
|
||||||
{
|
{
|
||||||
@@ -92,7 +96,7 @@ CursorManager::CreateCursor(team_id clientTeam, const uint8* cursorData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cursor->Acquire();
|
cursor->AcquireReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
@@ -101,8 +105,7 @@ CursorManager::CreateCursor(team_id clientTeam, const uint8* cursorData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Registers a cursor with the manager.
|
||||||
\brief Registers a cursor with the manager.
|
|
||||||
\param cursor ServerCursor object to register
|
\param cursor ServerCursor object to register
|
||||||
\return The token assigned to the cursor or B_ERROR if cursor is NULL
|
\return The token assigned to the cursor or B_ERROR if cursor is NULL
|
||||||
*/
|
*/
|
||||||
@@ -132,8 +135,7 @@ CursorManager::AddCursor(ServerCursor* cursor, int32 token)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Removes a cursor if it's not referenced anymore.
|
||||||
\brief Removes a cursor if it's not referenced anymore.
|
|
||||||
|
|
||||||
If this was the last reference to this cursor, it will be deleted.
|
If this was the last reference to this cursor, it will be deleted.
|
||||||
Only if the cursor is deleted, \c true is returned.
|
Only if the cursor is deleted, \c true is returned.
|
||||||
@@ -145,7 +147,7 @@ CursorManager::RemoveCursor(ServerCursor* cursor)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// TODO: this doesn't work as it looks like, and it's not safe!
|
// TODO: this doesn't work as it looks like, and it's not safe!
|
||||||
if (cursor->ReferenceCount() > 0) {
|
if (cursor->CountReferences() > 0) {
|
||||||
// cursor has been referenced again in the mean time
|
// cursor has been referenced again in the mean time
|
||||||
Unlock();
|
Unlock();
|
||||||
return false;
|
return false;
|
||||||
@@ -158,8 +160,7 @@ CursorManager::RemoveCursor(ServerCursor* cursor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Removes and deletes all of an application's cursors
|
||||||
\brief Removes and deletes all of an application's cursors
|
|
||||||
\param signature Signature to which the cursors belong
|
\param signature Signature to which the cursors belong
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
@@ -171,15 +172,14 @@ CursorManager::DeleteCursors(team_id team)
|
|||||||
for (int32 index = fCursorList.CountItems(); index-- > 0;) {
|
for (int32 index = fCursorList.CountItems(); index-- > 0;) {
|
||||||
ServerCursor *cursor = (ServerCursor*)fCursorList.ItemAtFast(index);
|
ServerCursor *cursor = (ServerCursor*)fCursorList.ItemAtFast(index);
|
||||||
if (cursor->OwningTeam() == team)
|
if (cursor->OwningTeam() == team)
|
||||||
cursor->Release();
|
cursor->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Sets all the cursors from a specified CursorSet
|
||||||
\brief Sets all the cursors from a specified CursorSet
|
|
||||||
\param path Path to the cursor set
|
\param path Path to the cursor set
|
||||||
|
|
||||||
All cursors in the set will be assigned. If the set does not specify a
|
All cursors in the set will be assigned. If the set does not specify a
|
||||||
@@ -200,63 +200,53 @@ CursorManager::SetCursorSet(const char *path)
|
|||||||
ServerCursor *cursor = NULL;
|
ServerCursor *cursor = NULL;
|
||||||
|
|
||||||
if (cursorSet.FindCursor(B_CURSOR_DEFAULT, &cursor) == B_OK) {
|
if (cursorSet.FindCursor(B_CURSOR_DEFAULT, &cursor) == B_OK) {
|
||||||
if (fDefaultCursor)
|
|
||||||
delete fDefaultCursor;
|
delete fDefaultCursor;
|
||||||
fDefaultCursor = cursor;
|
fDefaultCursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursorSet.FindCursor(B_CURSOR_TEXT, &cursor) == B_OK) {
|
if (cursorSet.FindCursor(B_CURSOR_TEXT, &cursor) == B_OK) {
|
||||||
if (fTextCursor)
|
|
||||||
delete fTextCursor;
|
delete fTextCursor;
|
||||||
fTextCursor = cursor;
|
fTextCursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursorSet.FindCursor(B_CURSOR_MOVE, &cursor) == B_OK) {
|
if (cursorSet.FindCursor(B_CURSOR_MOVE, &cursor) == B_OK) {
|
||||||
if (fMoveCursor)
|
|
||||||
delete fMoveCursor;
|
delete fMoveCursor;
|
||||||
fMoveCursor = cursor;
|
fMoveCursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursorSet.FindCursor(B_CURSOR_DRAG, &cursor) == B_OK) {
|
if (cursorSet.FindCursor(B_CURSOR_DRAG, &cursor) == B_OK) {
|
||||||
if (fDragCursor)
|
|
||||||
delete fDragCursor;
|
delete fDragCursor;
|
||||||
fDragCursor = cursor;
|
fDragCursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursorSet.FindCursor(B_CURSOR_RESIZE, &cursor) == B_OK) {
|
if (cursorSet.FindCursor(B_CURSOR_RESIZE, &cursor) == B_OK) {
|
||||||
if (fResizeCursor)
|
|
||||||
delete fResizeCursor;
|
delete fResizeCursor;
|
||||||
fResizeCursor = cursor;
|
fResizeCursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursorSet.FindCursor(B_CURSOR_RESIZE_NWSE, &cursor) == B_OK) {
|
if (cursorSet.FindCursor(B_CURSOR_RESIZE_NWSE, &cursor) == B_OK) {
|
||||||
if (fNWSECursor)
|
|
||||||
delete fNWSECursor;
|
delete fNWSECursor;
|
||||||
fNWSECursor = cursor;
|
fNWSECursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursorSet.FindCursor(B_CURSOR_RESIZE_NESW, &cursor) == B_OK) {
|
if (cursorSet.FindCursor(B_CURSOR_RESIZE_NESW, &cursor) == B_OK) {
|
||||||
if (fNESWCursor)
|
|
||||||
delete fNESWCursor;
|
delete fNESWCursor;
|
||||||
fNESWCursor = cursor;
|
fNESWCursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursorSet.FindCursor(B_CURSOR_RESIZE_NS, &cursor) == B_OK) {
|
if (cursorSet.FindCursor(B_CURSOR_RESIZE_NS, &cursor) == B_OK) {
|
||||||
if (fNSCursor)
|
|
||||||
delete fNSCursor;
|
delete fNSCursor;
|
||||||
fNSCursor = cursor;
|
fNSCursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursorSet.FindCursor(B_CURSOR_RESIZE_EW, &cursor) == B_OK) {
|
if (cursorSet.FindCursor(B_CURSOR_RESIZE_EW, &cursor) == B_OK) {
|
||||||
if (fEWCursor)
|
|
||||||
delete fEWCursor;
|
delete fEWCursor;
|
||||||
fEWCursor = cursor;
|
fEWCursor = cursor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Acquire the cursor which is used for a particular system cursor
|
||||||
\brief Acquire the cursor which is used for a particular system cursor
|
|
||||||
\param which Which system cursor to get
|
\param which Which system cursor to get
|
||||||
\return Pointer to the particular cursor used or NULL if which is
|
\return Pointer to the particular cursor used or NULL if which is
|
||||||
invalid or the cursor has not been assigned
|
invalid or the cursor has not been assigned
|
||||||
@@ -292,8 +282,7 @@ CursorManager::GetCursor(cursor_which which)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Gets the current system cursor value
|
||||||
\brief Gets the current system cursor value
|
|
||||||
\return The current cursor value or CURSOR_OTHER if some non-system cursor
|
\return The current cursor value or CURSOR_OTHER if some non-system cursor
|
||||||
*/
|
*/
|
||||||
cursor_which
|
cursor_which
|
||||||
@@ -310,8 +299,7 @@ CursorManager::GetCursorWhich()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Sets the specified system cursor to the a particular cursor
|
||||||
\brief Sets the specified system cursor to the a particular cursor
|
|
||||||
\param which Which system cursor to change
|
\param which Which system cursor to change
|
||||||
\param token The ID of the cursor to become the new one
|
\param token The ID of the cursor to become the new one
|
||||||
|
|
||||||
@@ -420,8 +408,7 @@ CursorManager::SetDefaults()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Internal function which finds the cursor with a particular ID
|
||||||
\brief Internal function which finds the cursor with a particular ID
|
|
||||||
\param token ID of the cursor to find
|
\param token ID of the cursor to find
|
||||||
\return The cursor or NULL if not found
|
\return The cursor or NULL if not found
|
||||||
*/
|
*/
|
||||||
@@ -464,16 +451,3 @@ CursorManager::_RemoveCursor(ServerCursor* cursor)
|
|||||||
fCursorList.RemoveItem(cursor);
|
fCursorList.RemoveItem(cursor);
|
||||||
fTokenSpace.RemoveToken(cursor->fToken);
|
fTokenSpace.RemoveToken(cursor->fToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//ServerCursor*
|
|
||||||
//CursorManager::_RemoveCursor(int32 index)
|
|
||||||
//{
|
|
||||||
// ServerCursor* cursor = (ServerCursor*)fCursorList.RemoveItem(index);
|
|
||||||
// if (cursor != NULL)
|
|
||||||
// fTokenSpace.RemoveToken(cursor->fToken);
|
|
||||||
//
|
|
||||||
// return cursor;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2008, Haiku, Inc. All Rights Reserved.
|
* Copyright 2005-2009, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -606,17 +606,18 @@ EventDispatcher::SetDragMessage(BMessage& message,
|
|||||||
|
|
||||||
if (fLastButtons == 0) {
|
if (fLastButtons == 0) {
|
||||||
// mouse buttons has already been released or was never pressed
|
// mouse buttons has already been released or was never pressed
|
||||||
gBitmapManager->DeleteBitmap(bitmap);
|
bitmap->ReleaseReference();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fDragBitmap != bitmap) {
|
if (fDragBitmap != bitmap) {
|
||||||
if (fDragBitmap)
|
if (fDragBitmap)
|
||||||
gBitmapManager->DeleteBitmap(fDragBitmap);
|
fDragBitmap->ReleaseReference();
|
||||||
|
|
||||||
fDragBitmap = bitmap;
|
fDragBitmap = bitmap;
|
||||||
|
|
||||||
if (fDragBitmap != NULL)
|
if (fDragBitmap != NULL)
|
||||||
fDragBitmap->Acquire();
|
fDragBitmap->AcquireReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
fHWInterface->SetDragBitmap(bitmap, offsetFromCursor);
|
fHWInterface->SetDragBitmap(bitmap, offsetFromCursor);
|
||||||
@@ -749,8 +750,10 @@ EventDispatcher::_DeliverDragMessage()
|
|||||||
fDraggingMessage = false;
|
fDraggingMessage = false;
|
||||||
|
|
||||||
fHWInterface->SetDragBitmap(NULL, B_ORIGIN);
|
fHWInterface->SetDragBitmap(NULL, B_ORIGIN);
|
||||||
gBitmapManager->DeleteBitmap(fDragBitmap);
|
if (fDragBitmap != NULL) {
|
||||||
|
fDragBitmap->ReleaseReference();
|
||||||
fDragBitmap = NULL;
|
fDragBitmap = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ OffscreenServerWindow::OffscreenServerWindow(const char *title, ServerApp *app,
|
|||||||
|
|
||||||
OffscreenServerWindow::~OffscreenServerWindow()
|
OffscreenServerWindow::~OffscreenServerWindow()
|
||||||
{
|
{
|
||||||
fBitmap->Release();
|
fBitmap->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ ServerApp::~ServerApp()
|
|||||||
ServerBitmap* bitmap = fBitmapMap.begin()->second;
|
ServerBitmap* bitmap = fBitmapMap.begin()->second;
|
||||||
|
|
||||||
fBitmapMap.erase(fBitmapMap.begin());
|
fBitmapMap.erase(fBitmapMap.begin());
|
||||||
bitmap->Release();
|
bitmap->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!fPictureMap.empty()) {
|
while (!fPictureMap.empty()) {
|
||||||
@@ -302,12 +302,12 @@ ServerApp::SetCurrentCursor(ServerCursor* cursor)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (fViewCursor)
|
if (fViewCursor)
|
||||||
fViewCursor->Release();
|
fViewCursor->ReleaseReference();
|
||||||
|
|
||||||
fViewCursor = cursor;
|
fViewCursor = cursor;
|
||||||
|
|
||||||
if (fViewCursor)
|
if (fViewCursor)
|
||||||
fViewCursor->Acquire();
|
fViewCursor->AcquireReference();
|
||||||
|
|
||||||
fDesktop->SetCursor(CurrentCursor());
|
fDesktop->SetCursor(CurrentCursor());
|
||||||
}
|
}
|
||||||
@@ -413,7 +413,7 @@ ServerApp::GetBitmap(int32 token) const
|
|||||||
if (bitmap == NULL)
|
if (bitmap == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
bitmap->Acquire();
|
bitmap->AcquireReference();
|
||||||
|
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
@@ -757,7 +757,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
fLink.Attach<int32>(bitmap->BytesPerRow());
|
fLink.Attach<int32>(bitmap->BytesPerRow());
|
||||||
} else {
|
} else {
|
||||||
if (bitmap != NULL)
|
if (bitmap != NULL)
|
||||||
bitmap->Release();
|
bitmap->ReleaseReference();
|
||||||
|
|
||||||
fLink.StartMessage(B_NO_MEMORY);
|
fLink.StartMessage(B_NO_MEMORY);
|
||||||
}
|
}
|
||||||
@@ -784,7 +784,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
STRACE(("ServerApp %s: Deleting Bitmap %ld\n", Signature(),
|
STRACE(("ServerApp %s: Deleting Bitmap %ld\n", Signature(),
|
||||||
token));
|
token));
|
||||||
|
|
||||||
bitmap->Release();
|
bitmap->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
fMapLocker.Unlock();
|
fMapLocker.Unlock();
|
||||||
@@ -807,7 +807,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
status = fDesktop->HWInterface()->GetOverlayRestrictions(
|
status = fDesktop->HWInterface()->GetOverlayRestrictions(
|
||||||
bitmap->Overlay(), &restrictions);
|
bitmap->Overlay(), &restrictions);
|
||||||
|
|
||||||
bitmap->Release();
|
bitmap->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
fLink.StartMessage(status);
|
fLink.StartMessage(status);
|
||||||
@@ -1031,13 +1031,13 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
ServerCursor* oldCursor = fAppCursor;
|
ServerCursor* oldCursor = fAppCursor;
|
||||||
fAppCursor = fDesktop->GetCursorManager().FindCursor(token);
|
fAppCursor = fDesktop->GetCursorManager().FindCursor(token);
|
||||||
if (fAppCursor != NULL)
|
if (fAppCursor != NULL)
|
||||||
fAppCursor->Acquire();
|
fAppCursor->AcquireReference();
|
||||||
|
|
||||||
if (_HasWindowUnderMouse())
|
if (_HasWindowUnderMouse())
|
||||||
fDesktop->SetCursor(CurrentCursor());
|
fDesktop->SetCursor(CurrentCursor());
|
||||||
|
|
||||||
if (oldCursor != NULL)
|
if (oldCursor != NULL)
|
||||||
oldCursor->Release();
|
oldCursor->ReleaseReference();
|
||||||
|
|
||||||
fDesktop->GetCursorManager().Unlock();
|
fDesktop->GetCursorManager().Unlock();
|
||||||
|
|
||||||
@@ -1063,7 +1063,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
// get a NULL cursor, it probably means we are supposed to use
|
// get a NULL cursor, it probably means we are supposed to use
|
||||||
// the system default cursor.
|
// the system default cursor.
|
||||||
if (cursor != NULL)
|
if (cursor != NULL)
|
||||||
cursor->Acquire();
|
cursor->AcquireReference();
|
||||||
|
|
||||||
fDesktop->GetCursorManager().Unlock();
|
fDesktop->GetCursorManager().Unlock();
|
||||||
|
|
||||||
@@ -1094,7 +1094,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
|
|
||||||
// Release the temporary reference.
|
// Release the temporary reference.
|
||||||
if (cursor != NULL)
|
if (cursor != NULL)
|
||||||
cursor->Release();
|
cursor->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.sync) {
|
if (info.sync) {
|
||||||
@@ -1164,7 +1164,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
ServerCursor* cursor
|
ServerCursor* cursor
|
||||||
= fDesktop->GetCursorManager().FindCursor(token);
|
= fDesktop->GetCursorManager().FindCursor(token);
|
||||||
if (cursor != NULL)
|
if (cursor != NULL)
|
||||||
cursor->Acquire();
|
cursor->AcquireReference();
|
||||||
|
|
||||||
fDesktop->GetCursorManager().Unlock();
|
fDesktop->GetCursorManager().Unlock();
|
||||||
|
|
||||||
@@ -1185,7 +1185,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
ServerCursor* cursor
|
ServerCursor* cursor
|
||||||
= fDesktop->GetCursorManager().FindCursor(token);
|
= fDesktop->GetCursorManager().FindCursor(token);
|
||||||
if (cursor != NULL)
|
if (cursor != NULL)
|
||||||
cursor->Release();
|
cursor->ReleaseReference();
|
||||||
|
|
||||||
fDesktop->GetCursorManager().Unlock();
|
fDesktop->GetCursorManager().Unlock();
|
||||||
|
|
||||||
@@ -2861,7 +2861,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
} else
|
} else
|
||||||
fLink.StartMessage(B_BAD_VALUE);
|
fLink.StartMessage(B_BAD_VALUE);
|
||||||
|
|
||||||
gBitmapManager->DeleteBitmap(bitmap);
|
bitmap->ReleaseReference();
|
||||||
} else
|
} else
|
||||||
fLink.StartMessage(B_BAD_VALUE);
|
fLink.StartMessage(B_BAD_VALUE);
|
||||||
|
|
||||||
|
|||||||
@@ -123,42 +123,18 @@ ServerBitmap::~ServerBitmap()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ServerBitmap::Acquire()
|
|
||||||
{
|
|
||||||
atomic_add(&fReferenceCount, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ServerBitmap::Release()
|
|
||||||
{
|
|
||||||
gBitmapManager->DeleteBitmap(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
ServerBitmap::_Release()
|
|
||||||
{
|
|
||||||
if (atomic_add(&fReferenceCount, -1) == 1)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Internal function used by subclasses
|
/*! \brief Internal function used by subclasses
|
||||||
|
|
||||||
Subclasses should call this so the buffer can automagically
|
Subclasses should call this so the buffer can automagically
|
||||||
be allocated on the heap.
|
be allocated on the heap.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ServerBitmap::_AllocateBuffer(void)
|
ServerBitmap::AllocateBuffer()
|
||||||
{
|
{
|
||||||
uint32 length = BitsLength();
|
uint32 length = BitsLength();
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
delete[] fBuffer;
|
delete[] fBuffer;
|
||||||
fBuffer = new(nothrow) uint8[length];
|
fBuffer = new(std::nothrow) uint8[length];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +228,17 @@ ServerBitmap::PrintToStream()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ServerBitmap::LastReferenceReleased()
|
||||||
|
{
|
||||||
|
if (fOwner != NULL)
|
||||||
|
fOwner->BitmapRemoved(this);
|
||||||
|
|
||||||
|
gBitmapManager->BitmapRemoved(this);
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
@@ -259,14 +246,14 @@ UtilityBitmap::UtilityBitmap(BRect rect, color_space space, uint32 flags,
|
|||||||
int32 bytesperline, screen_id screen)
|
int32 bytesperline, screen_id screen)
|
||||||
: ServerBitmap(rect, space, flags, bytesperline, screen)
|
: ServerBitmap(rect, space, flags, bytesperline, screen)
|
||||||
{
|
{
|
||||||
_AllocateBuffer();
|
AllocateBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UtilityBitmap::UtilityBitmap(const ServerBitmap* bitmap)
|
UtilityBitmap::UtilityBitmap(const ServerBitmap* bitmap)
|
||||||
: ServerBitmap(bitmap)
|
: ServerBitmap(bitmap)
|
||||||
{
|
{
|
||||||
_AllocateBuffer();
|
AllocateBuffer();
|
||||||
|
|
||||||
if (bitmap->Bits())
|
if (bitmap->Bits())
|
||||||
memcpy(Bits(), bitmap->Bits(), bitmap->BitsLength());
|
memcpy(Bits(), bitmap->Bits(), bitmap->BitsLength());
|
||||||
@@ -277,7 +264,7 @@ UtilityBitmap::UtilityBitmap(const uint8* alreadyPaddedData, uint32 width,
|
|||||||
uint32 height, color_space format)
|
uint32 height, color_space format)
|
||||||
: ServerBitmap(BRect(0, 0, width - 1, height - 1), format, 0)
|
: ServerBitmap(BRect(0, 0, width - 1, height - 1), format, 0)
|
||||||
{
|
{
|
||||||
_AllocateBuffer();
|
AllocateBuffer();
|
||||||
if (Bits())
|
if (Bits())
|
||||||
memcpy(Bits(), alreadyPaddedData, BitsLength());
|
memcpy(Bits(), alreadyPaddedData, BitsLength());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include <Referenceable.h>
|
||||||
|
|
||||||
|
|
||||||
class BitmapManager;
|
class BitmapManager;
|
||||||
class ClientMemoryAllocator;
|
class ClientMemoryAllocator;
|
||||||
class HWInterface;
|
class HWInterface;
|
||||||
@@ -28,14 +31,11 @@ class ServerApp;
|
|||||||
managed by the BitmapManager class. It is also the base class for
|
managed by the BitmapManager class. It is also the base class for
|
||||||
all cursors. Every BBitmap has a shadow ServerBitmap object.
|
all cursors. Every BBitmap has a shadow ServerBitmap object.
|
||||||
*/
|
*/
|
||||||
class ServerBitmap {
|
class ServerBitmap : public Referenceable {
|
||||||
public:
|
public:
|
||||||
inline bool IsValid() const
|
inline bool IsValid() const
|
||||||
{ return fBuffer != NULL; }
|
{ return fBuffer != NULL; }
|
||||||
|
|
||||||
void Acquire();
|
|
||||||
void Release();
|
|
||||||
|
|
||||||
inline uint8* Bits() const
|
inline uint8* Bits() const
|
||||||
{ return fBuffer; }
|
{ return fBuffer; }
|
||||||
inline uint32 BitsLength() const
|
inline uint32 BitsLength() const
|
||||||
@@ -93,10 +93,11 @@ protected:
|
|||||||
ServerBitmap(const ServerBitmap* bmp);
|
ServerBitmap(const ServerBitmap* bmp);
|
||||||
virtual ~ServerBitmap();
|
virtual ~ServerBitmap();
|
||||||
|
|
||||||
bool _Release();
|
virtual void LastReferenceReleased();
|
||||||
|
|
||||||
void _AllocateBuffer();
|
void AllocateBuffer();
|
||||||
|
|
||||||
|
protected:
|
||||||
ClientMemoryAllocator* fAllocator;
|
ClientMemoryAllocator* fAllocator;
|
||||||
void* fAllocationCookie;
|
void* fAllocationCookie;
|
||||||
::Overlay* fOverlay;
|
::Overlay* fOverlay;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2006, Haiku.
|
* Copyright 2001-2009, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -8,13 +8,16 @@
|
|||||||
* Axel Dörfler, axeld@pinc-software.de
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
Although descended from ServerBitmaps, ServerCursors are not handled by
|
/*! Although descended from ServerBitmaps, ServerCursors are not handled by
|
||||||
the BitmapManager - they are allocated like any other object. Unlike BeOS
|
the BitmapManager, but the CursorManager instead. Until they have been
|
||||||
R5, cursors can be any size or color space, and this class accomodates and
|
attached to a CursorManager, you can delete cursors like any other object.
|
||||||
expands the R5 API.
|
|
||||||
|
Unlike BeOS, cursors can be any size or color space, and this class
|
||||||
|
accomodates and expands the BeOS API.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "CursorManager.h"
|
#include "CursorManager.h"
|
||||||
#include "ServerCursor.h"
|
#include "ServerCursor.h"
|
||||||
|
|
||||||
@@ -26,13 +29,15 @@
|
|||||||
|
|
||||||
using std::nothrow;
|
using std::nothrow;
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Constructor
|
/*! \brief Constructor
|
||||||
|
|
||||||
\param r Size of the cursor
|
\param r Size of the cursor
|
||||||
\param cspace Color space of the cursor
|
\param cspace Color space of the cursor
|
||||||
\param flags ServerBitmap flags. See Bitmap.h.
|
\param flags ServerBitmap flags. See Bitmap.h.
|
||||||
\param hotspot Hotspot of the cursor
|
\param hotspot Hotspot of the cursor
|
||||||
\param bytesperline Bytes per row for the cursor. See ServerBitmap::ServerBitmap()
|
\param bytesperline Bytes per row for the cursor. See
|
||||||
|
ServerBitmap::ServerBitmap()
|
||||||
|
|
||||||
*/
|
*/
|
||||||
ServerCursor::ServerCursor(BRect r, color_space format, int32 flags,
|
ServerCursor::ServerCursor(BRect r, color_space format, int32 flags,
|
||||||
@@ -41,37 +46,36 @@ ServerCursor::ServerCursor(BRect r, color_space format, int32 flags,
|
|||||||
ServerBitmap(r, format, flags, bytesPerRow, screen),
|
ServerBitmap(r, format, flags, bytesPerRow, screen),
|
||||||
fHotSpot(hotspot),
|
fHotSpot(hotspot),
|
||||||
fOwningTeam(-1),
|
fOwningTeam(-1),
|
||||||
fReferenceCount(1),
|
|
||||||
fCursorData(NULL),
|
fCursorData(NULL),
|
||||||
fManager(NULL)
|
fManager(NULL)
|
||||||
{
|
{
|
||||||
fHotSpot.ConstrainTo(Bounds());
|
fHotSpot.ConstrainTo(Bounds());
|
||||||
_AllocateBuffer();
|
AllocateBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Constructor
|
||||||
\brief Constructor
|
\param data Pointer to 68-byte cursor data array. See BeBook entry for
|
||||||
\param data Pointer to 68-byte cursor data array. See BeBook entry for BCursor for details
|
BCursor for details
|
||||||
*/
|
*/
|
||||||
ServerCursor::ServerCursor(const uint8* data)
|
ServerCursor::ServerCursor(const uint8* data)
|
||||||
:
|
:
|
||||||
ServerBitmap(BRect(0, 0, 15, 15), B_RGBA32, 0),
|
ServerBitmap(BRect(0, 0, 15, 15), B_RGBA32, 0),
|
||||||
fHotSpot(0, 0),
|
fHotSpot(0, 0),
|
||||||
fOwningTeam(-1),
|
fOwningTeam(-1),
|
||||||
fReferenceCount(1),
|
|
||||||
fCursorData(NULL),
|
fCursorData(NULL),
|
||||||
fManager(NULL)
|
fManager(NULL)
|
||||||
{
|
{
|
||||||
// 68-byte array used in R5 for holding cursors.
|
// 68-byte array used in BeOS for holding cursors.
|
||||||
// This API has serious problems and should be deprecated(but supported) in R2
|
// This API has serious problems and should be deprecated (but supported)
|
||||||
|
// in R2
|
||||||
|
|
||||||
// Now that we have all the setup, we're going to map (for now) the cursor
|
// Now that we have all the setup, we're going to map (for now) the cursor
|
||||||
// to RGBA32 (little endian). Eventually, there will be support for 16 and
|
// to RGBA32 (little endian). Eventually, there will be support for 16 and
|
||||||
// 8-bit depths
|
// 8-bit depths
|
||||||
// NOTE: review this once we have working PPC graphics cards (big endian).
|
// NOTE: review this once we have working PPC graphics cards (big endian).
|
||||||
if (data) {
|
if (data) {
|
||||||
_AllocateBuffer();
|
AllocateBuffer();
|
||||||
uint8* buffer = Bits();
|
uint8* buffer = Bits();
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return;
|
return;
|
||||||
@@ -116,8 +120,7 @@ ServerCursor::ServerCursor(const uint8* data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Constructor
|
||||||
\brief Constructor
|
|
||||||
\param data Pointer to bitmap data in memory,
|
\param data Pointer to bitmap data in memory,
|
||||||
the padding bytes should be contained when format less than 32 bpp.
|
the padding bytes should be contained when format less than 32 bpp.
|
||||||
*/
|
*/
|
||||||
@@ -127,18 +130,16 @@ ServerCursor::ServerCursor(const uint8* alreadyPaddedData, uint32 width,
|
|||||||
ServerBitmap(BRect(0, 0, width - 1, height - 1), format, 0),
|
ServerBitmap(BRect(0, 0, width - 1, height - 1), format, 0),
|
||||||
fHotSpot(0, 0),
|
fHotSpot(0, 0),
|
||||||
fOwningTeam(-1),
|
fOwningTeam(-1),
|
||||||
fReferenceCount(1),
|
|
||||||
fCursorData(NULL),
|
fCursorData(NULL),
|
||||||
fManager(NULL)
|
fManager(NULL)
|
||||||
{
|
{
|
||||||
_AllocateBuffer();
|
AllocateBuffer();
|
||||||
if (Bits())
|
if (Bits())
|
||||||
memcpy(Bits(), alreadyPaddedData, BitsLength());
|
memcpy(Bits(), alreadyPaddedData, BitsLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Copy constructor
|
||||||
\brief Copy constructor
|
|
||||||
\param cursor cursor to copy
|
\param cursor cursor to copy
|
||||||
*/
|
*/
|
||||||
ServerCursor::ServerCursor(const ServerCursor* cursor)
|
ServerCursor::ServerCursor(const ServerCursor* cursor)
|
||||||
@@ -146,13 +147,12 @@ ServerCursor::ServerCursor(const ServerCursor* cursor)
|
|||||||
ServerBitmap(cursor),
|
ServerBitmap(cursor),
|
||||||
fHotSpot(0, 0),
|
fHotSpot(0, 0),
|
||||||
fOwningTeam(-1),
|
fOwningTeam(-1),
|
||||||
fReferenceCount(1),
|
|
||||||
fCursorData(NULL),
|
fCursorData(NULL),
|
||||||
fManager(NULL)
|
fManager(NULL)
|
||||||
{
|
{
|
||||||
// TODO: Hm. I don't move this into the if clause,
|
// TODO: Hm. I don't move this into the if clause,
|
||||||
// because it might break code elsewhere.
|
// because it might break code elsewhere.
|
||||||
_AllocateBuffer();
|
AllocateBuffer();
|
||||||
|
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
if (Bits() && cursor->Bits())
|
if (Bits() && cursor->Bits())
|
||||||
@@ -174,8 +174,7 @@ ServerCursor::~ServerCursor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Sets the cursor's hotspot
|
||||||
\brief Sets the cursor's hotspot
|
|
||||||
\param pt New location of hotspot, constrained to the cursor's boundaries.
|
\param pt New location of hotspot, constrained to the cursor's boundaries.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
@@ -186,23 +185,17 @@ ServerCursor::SetHotSpot(BPoint hotSpot)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
ServerCursor::Release()
|
|
||||||
{
|
|
||||||
if (atomic_add(&fReferenceCount, -1) == 1) {
|
|
||||||
if (fManager && !fManager->RemoveCursor(this))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
delete this;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerCursor::AttachedToManager(CursorManager* manager)
|
ServerCursor::AttachedToManager(CursorManager* manager)
|
||||||
{
|
{
|
||||||
fManager = manager;
|
fManager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ServerCursor::LastReferenceReleased()
|
||||||
|
{
|
||||||
|
if (fManager != NULL && fManager->RemoveCursor(this))
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2006, Haiku.
|
* Copyright 2001-2009, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -16,15 +16,15 @@
|
|||||||
#include <Point.h>
|
#include <Point.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
class ServerApp;
|
|
||||||
class CursorManager;
|
class CursorManager;
|
||||||
|
|
||||||
|
|
||||||
class ServerCursor : public ServerBitmap {
|
class ServerCursor : public ServerBitmap {
|
||||||
public:
|
public:
|
||||||
ServerCursor(BRect r, color_space space,
|
ServerCursor(BRect r, color_space space,
|
||||||
int32 flags, BPoint hotspot,
|
int32 flags, BPoint hotspot,
|
||||||
int32 bytesperrow = -1,
|
int32 bytesPerRow = -1,
|
||||||
screen_id screen = B_MAIN_SCREEN_ID);
|
screen_id screen = B_MAIN_SCREEN_ID);
|
||||||
ServerCursor(const uint8* cursorDataFromR5);
|
ServerCursor(const uint8* cursorDataFromR5);
|
||||||
ServerCursor(const uint8* alreadyPaddedData,
|
ServerCursor(const uint8* alreadyPaddedData,
|
||||||
@@ -47,22 +47,19 @@ class ServerCursor : public ServerBitmap {
|
|||||||
int32 Token() const
|
int32 Token() const
|
||||||
{ return fToken; }
|
{ return fToken; }
|
||||||
|
|
||||||
void Acquire()
|
|
||||||
{ atomic_add(&fReferenceCount, 1); }
|
|
||||||
bool Release();
|
|
||||||
int32 ReferenceCount() { return fReferenceCount; }
|
|
||||||
|
|
||||||
void AttachedToManager(CursorManager* manager);
|
void AttachedToManager(CursorManager* manager);
|
||||||
|
|
||||||
const uint8* CursorData() const
|
const uint8* CursorData() const
|
||||||
{ return fCursorData; }
|
{ return fCursorData; }
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
virtual void LastReferenceReleased();
|
||||||
|
|
||||||
|
private:
|
||||||
friend class CursorManager;
|
friend class CursorManager;
|
||||||
|
|
||||||
BPoint fHotSpot;
|
BPoint fHotSpot;
|
||||||
team_id fOwningTeam;
|
team_id fOwningTeam;
|
||||||
vint32 fReferenceCount;
|
|
||||||
uint8* fCursorData;
|
uint8* fCursorData;
|
||||||
CursorManager* fManager;
|
CursorManager* fManager;
|
||||||
};
|
};
|
||||||
@@ -71,25 +68,31 @@ class ServerCursor : public ServerBitmap {
|
|||||||
class ServerCursorReference {
|
class ServerCursorReference {
|
||||||
public:
|
public:
|
||||||
ServerCursorReference()
|
ServerCursorReference()
|
||||||
: fCursor(NULL)
|
:
|
||||||
|
fCursor(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerCursorReference(ServerCursor* cursor)
|
ServerCursorReference(ServerCursor* cursor)
|
||||||
: fCursor(cursor)
|
:
|
||||||
|
fCursor(cursor)
|
||||||
{
|
{
|
||||||
if (fCursor)
|
if (fCursor)
|
||||||
fCursor->Acquire();
|
fCursor->AcquireReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerCursorReference(const ServerCursorReference& other)
|
ServerCursorReference(const ServerCursorReference& other)
|
||||||
: fCursor(other.fCursor)
|
:
|
||||||
|
fCursor(other.fCursor)
|
||||||
{
|
{
|
||||||
if (fCursor)
|
if (fCursor)
|
||||||
fCursor->Acquire();
|
fCursor->AcquireReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~ServerCursorReference()
|
virtual ~ServerCursorReference()
|
||||||
{
|
{
|
||||||
if (fCursor)
|
if (fCursor)
|
||||||
fCursor->Release();
|
fCursor->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerCursorReference& operator=(const ServerCursorReference& other)
|
ServerCursorReference& operator=(const ServerCursorReference& other)
|
||||||
@@ -102,17 +105,23 @@ public:
|
|||||||
{
|
{
|
||||||
if (fCursor == cursor)
|
if (fCursor == cursor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (cursor)
|
if (cursor)
|
||||||
cursor->Acquire();
|
cursor->AcquireReference();
|
||||||
|
|
||||||
ServerCursor* oldCursor = fCursor;
|
ServerCursor* oldCursor = fCursor;
|
||||||
|
|
||||||
fCursor = cursor;
|
fCursor = cursor;
|
||||||
|
|
||||||
if (oldCursor)
|
if (oldCursor)
|
||||||
oldCursor->Release();
|
oldCursor->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerCursor* Cursor() const
|
ServerCursor* Cursor() const
|
||||||
{
|
{
|
||||||
return fCursor;
|
return fCursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ServerCursor* fCursor;
|
ServerCursor* fCursor;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1820,7 +1820,7 @@ fDesktop->LockSingleWindow();
|
|||||||
colorKey = bitmap->Overlay()->Color();
|
colorKey = bitmap->Overlay()->Color();
|
||||||
}
|
}
|
||||||
|
|
||||||
bitmap->Release();
|
bitmap->ReleaseReference();
|
||||||
} else
|
} else
|
||||||
status = B_BAD_VALUE;
|
status = B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
@@ -1999,7 +1999,7 @@ fDesktop->UnlockSingleWindow();
|
|||||||
fDesktop->EventDispatcher().SetDragMessage(dragMessage,
|
fDesktop->EventDispatcher().SetDragMessage(dragMessage,
|
||||||
bitmap, offset);
|
bitmap, offset);
|
||||||
fDesktop->LockSingleWindow();
|
fDesktop->LockSingleWindow();
|
||||||
bitmap->Release();
|
bitmap->ReleaseReference();
|
||||||
}
|
}
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
}
|
}
|
||||||
@@ -2283,7 +2283,7 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code,
|
|||||||
drawingEngine->DrawBitmap(bitmap, info.bitmapRect,
|
drawingEngine->DrawBitmap(bitmap, info.bitmapRect,
|
||||||
info.viewRect, info.options);
|
info.viewRect, info.options);
|
||||||
|
|
||||||
bitmap->Release();
|
bitmap->ReleaseReference();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3128,7 +3128,7 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
bitmap->ColorSpace(), info.options, bitmap->Bits(),
|
bitmap->ColorSpace(), info.options, bitmap->Bits(),
|
||||||
bitmap->BitsLength());
|
bitmap->BitsLength());
|
||||||
|
|
||||||
bitmap->Release();
|
bitmap->ReleaseReference();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ View::View(IntRect frame, IntPoint scrollingOffset, const char* name,
|
|||||||
View::~View()
|
View::~View()
|
||||||
{
|
{
|
||||||
if (fViewBitmap != NULL)
|
if (fViewBitmap != NULL)
|
||||||
gBitmapManager->DeleteBitmap(fViewBitmap);
|
fViewBitmap->ReleaseReference();
|
||||||
|
|
||||||
delete fScreenAndUserClipping;
|
delete fScreenAndUserClipping;
|
||||||
delete fUserClipping;
|
delete fUserClipping;
|
||||||
@@ -137,7 +137,7 @@ View::~View()
|
|||||||
// fWindow->SetTopView(NULL);
|
// fWindow->SetTopView(NULL);
|
||||||
|
|
||||||
if (fCursor)
|
if (fCursor)
|
||||||
fCursor->Release();
|
fCursor->ReleaseReference();
|
||||||
|
|
||||||
// iterate over children and delete each one
|
// iterate over children and delete each one
|
||||||
View* view = fFirstChild;
|
View* view = fFirstChild;
|
||||||
@@ -522,12 +522,12 @@ View::SetViewBitmap(ServerBitmap* bitmap, IntRect sourceRect,
|
|||||||
} else if (overlay != NULL)
|
} else if (overlay != NULL)
|
||||||
overlay->Hide();
|
overlay->Hide();
|
||||||
|
|
||||||
gBitmapManager->DeleteBitmap(fViewBitmap);
|
fViewBitmap->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
// the caller is allowed to delete the bitmap after setting the background
|
// the caller is allowed to delete the bitmap after setting the background
|
||||||
if (bitmap != NULL)
|
if (bitmap != NULL)
|
||||||
bitmap->Acquire();
|
bitmap->AcquireReference();
|
||||||
|
|
||||||
fViewBitmap = bitmap;
|
fViewBitmap = bitmap;
|
||||||
fBitmapSource = sourceRect;
|
fBitmapSource = sourceRect;
|
||||||
@@ -1297,12 +1297,12 @@ View::SetCursor(ServerCursor* cursor)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (fCursor)
|
if (fCursor)
|
||||||
fCursor->Release();
|
fCursor->ReleaseReference();
|
||||||
|
|
||||||
fCursor = cursor;
|
fCursor = cursor;
|
||||||
|
|
||||||
if (fCursor)
|
if (fCursor)
|
||||||
fCursor->Acquire();
|
fCursor->AcquireReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -152,12 +152,12 @@ HWInterface::SetCursor(ServerCursor* cursor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fCursor)
|
if (fCursor)
|
||||||
fCursor->Release();
|
fCursor->ReleaseReference();
|
||||||
|
|
||||||
fCursor = cursor;
|
fCursor = cursor;
|
||||||
|
|
||||||
if (fCursor)
|
if (fCursor)
|
||||||
fCursor->Acquire();
|
fCursor->AcquireReference();
|
||||||
|
|
||||||
Invalidate(oldFrame);
|
Invalidate(oldFrame);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user