* fixes the cursor handling after Axels changes, it crashed on real HW.
Axel, I think you didn't realise that _CursorFrame() gave and invalid BRect for fCursorVisible=false, but that rect was used to create the backup area, so it was buggy at that place. I removed your checks for fCursorVisible in SetCursor() for cleaner code, but left it in MoveCursor() because it might save a few cycles. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14954 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -48,18 +48,16 @@ HWInterface::SetCursor(ServerCursor* cursor)
|
|||||||
delete fCursor;
|
delete fCursor;
|
||||||
delete fCursorAreaBackup;
|
delete fCursorAreaBackup;
|
||||||
fCursor = cursor;
|
fCursor = cursor;
|
||||||
if (fCursorVisible)
|
Invalidate(oldFrame);
|
||||||
Invalidate(oldFrame);
|
|
||||||
BRect r = _CursorFrame();
|
BRect r = _CursorFrame();
|
||||||
if (fCursor && !IsDoubleBuffered()) {
|
if (fCursor && !IsDoubleBuffered()) {
|
||||||
fCursorAreaBackup = new buffer_clip(r.IntegerWidth() + 1,
|
BRect cursorBounds = fCursor->Bounds();
|
||||||
r.IntegerHeight() + 1);
|
fCursorAreaBackup = new buffer_clip(cursorBounds.IntegerWidth() + 1,
|
||||||
if (fCursorVisible)
|
cursorBounds.IntegerHeight() + 1);
|
||||||
_DrawCursor(r);
|
_DrawCursor(r);
|
||||||
} else
|
} else
|
||||||
fCursorAreaBackup = NULL;
|
fCursorAreaBackup = NULL;
|
||||||
if (fCursorVisible)
|
Invalidate(r);
|
||||||
Invalidate(r);
|
|
||||||
}
|
}
|
||||||
WriteUnlock();
|
WriteUnlock();
|
||||||
}
|
}
|
||||||
@@ -99,13 +97,19 @@ HWInterface::MoveCursorTo(const float& x, const float& y)
|
|||||||
if (p != fCursorLocation) {
|
if (p != fCursorLocation) {
|
||||||
BRect oldFrame = _CursorFrame();
|
BRect oldFrame = _CursorFrame();
|
||||||
fCursorLocation = p;
|
fCursorLocation = p;
|
||||||
if (fCursorAreaBackup && fCursorVisible) {
|
if (fCursorVisible) {
|
||||||
// means we have a software cursor which we need to draw
|
// Invalidate and _DrawCursor would not draw
|
||||||
_RestoreCursorArea();
|
// anything if the cursor is hidden
|
||||||
_DrawCursor(_CursorFrame());
|
// (invalid cursor frame), but explicitly
|
||||||
|
// testing for it here saves us some cycles
|
||||||
|
if (fCursorAreaBackup) {
|
||||||
|
// means we have a software cursor which we need to draw
|
||||||
|
_RestoreCursorArea();
|
||||||
|
_DrawCursor(_CursorFrame());
|
||||||
|
}
|
||||||
|
Invalidate(oldFrame);
|
||||||
|
Invalidate(_CursorFrame());
|
||||||
}
|
}
|
||||||
Invalidate(oldFrame);
|
|
||||||
Invalidate(_CursorFrame());
|
|
||||||
}
|
}
|
||||||
WriteUnlock();
|
WriteUnlock();
|
||||||
}
|
}
|
||||||
@@ -248,7 +252,7 @@ void
|
|||||||
HWInterface::_DrawCursor(BRect area) const
|
HWInterface::_DrawCursor(BRect area) const
|
||||||
{
|
{
|
||||||
RenderingBuffer* backBuffer = DrawingBuffer();
|
RenderingBuffer* backBuffer = DrawingBuffer();
|
||||||
if (!backBuffer)
|
if (!backBuffer || !area.IsValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BRect cf = _CursorFrame();
|
BRect cf = _CursorFrame();
|
||||||
@@ -289,7 +293,7 @@ HWInterface::_DrawCursor(BRect area) const
|
|||||||
|
|
||||||
uint8* dst = buffer;
|
uint8* dst = buffer;
|
||||||
|
|
||||||
if (fCursorAreaBackup) {
|
if (fCursorAreaBackup && fCursorAreaBackup->buffer) {
|
||||||
//printf("backup: BRect(%ld, %ld, %ld, %ld)\n", left, top, right, bottom);
|
//printf("backup: BRect(%ld, %ld, %ld, %ld)\n", left, top, right, bottom);
|
||||||
fCursorAreaBackup->cursor_hidden = false;
|
fCursorAreaBackup->cursor_hidden = false;
|
||||||
// remember which area the backup contains
|
// remember which area the backup contains
|
||||||
|
|||||||
Reference in New Issue
Block a user