* I decided having the cursor obscuring feature in the HWInterface class

was not such a bad idea after all.
* Reenabled obscuring the cursor in ServerApp.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15925 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2006-01-12 11:46:49 +00:00
parent 96cc308448
commit cf6fe303d6
3 changed files with 24 additions and 2 deletions

View File

@ -877,8 +877,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
case AS_OBSCURE_CURSOR:
{
STRACE(("ServerApp %s: Obscure Cursor\n", Signature()));
// ToDo: Enable ObscureCursor
//fDesktop->HWInterface()->ObscureCursor();
fDesktop->HWInterface()->ObscureCursor();
break;
}
case AS_QUERY_CURSOR_HIDDEN:

View File

@ -26,6 +26,7 @@ HWInterface::HWInterface(bool doubleBuffered)
fDragBitmapOffset(0, 0),
fCursorAndDragBitmap(NULL),
fCursorVisible(false),
fCursorObscured(false),
fCursorLocation(0, 0),
fDoubleBuffered(doubleBuffered),
// fUpdateExecutor(new UpdateQueue(this))
@ -105,6 +106,7 @@ HWInterface::SetCursorVisible(bool visible)
// fCursorVisible == false!
if (visible) {
fCursorVisible = visible;
fCursorObscured = false;
BRect r = _CursorFrame();
_DrawCursor(r);
@ -133,6 +135,19 @@ HWInterface::IsCursorVisible()
return visible;
}
// ObscureCursor
void
HWInterface::ObscureCursor()
{
if (WriteLock()) {
if (!fCursorObscured) {
SetCursorVisible(false);
fCursorObscured = true;
}
WriteUnlock();
}
}
// MoveCursorTo
void
HWInterface::MoveCursorTo(const float& x, const float& y)
@ -140,6 +155,12 @@ HWInterface::MoveCursorTo(const float& x, const float& y)
if (WriteLock()) {
BPoint p(x, y);
if (p != fCursorLocation) {
// unhide cursor if it is obscured only
if (fCursorObscured) {
// TODO: causes nested lock, which
// the MultiLocker doesn't actually support?
SetCursorVisible(true);
}
BRect oldFrame = _CursorFrame();
fCursorLocation = p;
if (fCursorVisible) {

View File

@ -79,6 +79,7 @@ class HWInterface : public MultiLocker {
virtual void SetCursor(ServerCursor* cursor);
virtual void SetCursorVisible(bool visible);
bool IsCursorVisible();
virtual void ObscureCursor();
virtual void MoveCursorTo(const float& x,
const float& y);
BPoint GetCursorPosition();
@ -168,6 +169,7 @@ class HWInterface : public MultiLocker {
BPoint fDragBitmapOffset;
ServerCursor* fCursorAndDragBitmap;
bool fCursorVisible;
bool fCursorObscured;
BPoint fCursorLocation;
bool fDoubleBuffered;