* Fixed misbehaviour of AS_SET_CURSOR: it will no longer set the mouse cursor
when it's not over a view of the application. * The application cursor is no longer applied when the mouse cursor is over the border (or tab) of a window. * Gave up and imitate BeOS behaviour: the mouse cursor now always get the shape the view below dictates, ie. it will no longer fall back to the default cursor outside the focus window. * The window is now set to the default in case there is no window under it at all (ie. if Tracker isn't running). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16685 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -244,8 +244,10 @@ MouseFilter::Filter(BMessage* message, EventTarget** _target, int32* _viewToken,
|
|||||||
*_target = &window->EventTarget();
|
*_target = &window->EventTarget();
|
||||||
else
|
else
|
||||||
*_target = NULL;
|
*_target = NULL;
|
||||||
} else
|
} else {
|
||||||
|
fDesktop->SetCursor(NULL);
|
||||||
*_target = NULL;
|
*_target = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
fDesktop->UnlockAllWindows();
|
fDesktop->UnlockAllWindows();
|
||||||
|
|
||||||
|
|||||||
@@ -265,6 +265,22 @@ ServerApp::SendMessageToClient(BMessage *msg) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
ServerApp::_HasWindowUnderMouse()
|
||||||
|
{
|
||||||
|
BAutolock locker(fWindowListLock);
|
||||||
|
|
||||||
|
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
|
||||||
|
ServerWindow* window = fWindowList.ItemAt(i);
|
||||||
|
|
||||||
|
if (fDesktop->EventDispatcher().ViewUnderMouse(window->EventTarget()) != B_NULL_TOKEN)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sets the ServerApp's active status
|
\brief Sets the ServerApp's active status
|
||||||
\param value The new status of the ServerApp.
|
\param value The new status of the ServerApp.
|
||||||
@@ -283,8 +299,10 @@ ServerApp::Activate(bool value)
|
|||||||
fIsActive = value;
|
fIsActive = value;
|
||||||
|
|
||||||
if (fIsActive) {
|
if (fIsActive) {
|
||||||
// Set the cursor to the application cursor, if any
|
if (_HasWindowUnderMouse()) {
|
||||||
fDesktop->SetCursor(CurrentCursor());
|
// Set the cursor to the application cursor, if any
|
||||||
|
fDesktop->SetCursor(CurrentCursor());
|
||||||
|
}
|
||||||
fDesktop->HWInterface()->SetCursorVisible(fCursorHideLevel == 0);
|
fDesktop->HWInterface()->SetCursorVisible(fCursorHideLevel == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -958,7 +976,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
if (fAppCursor != NULL)
|
if (fAppCursor != NULL)
|
||||||
fAppCursor->Acquire();
|
fAppCursor->Acquire();
|
||||||
|
|
||||||
if (fIsActive)
|
if (_HasWindowUnderMouse())
|
||||||
fDesktop->SetCursor(CurrentCursor());
|
fDesktop->SetCursor(CurrentCursor());
|
||||||
|
|
||||||
if (oldCursor != NULL)
|
if (oldCursor != NULL)
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ class ServerApp : public MessageLooper {
|
|||||||
BPrivate::LinkReceiver& link,
|
BPrivate::LinkReceiver& link,
|
||||||
port_id& clientReplyPort);
|
port_id& clientReplyPort);
|
||||||
|
|
||||||
|
bool _HasWindowUnderMouse();
|
||||||
|
|
||||||
port_id fMessagePort;
|
port_id fMessagePort;
|
||||||
port_id fClientReplyPort;
|
port_id fClientReplyPort;
|
||||||
// our BApplication's event port
|
// our BApplication's event port
|
||||||
|
|||||||
@@ -987,10 +987,10 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken,
|
|||||||
|
|
||||||
// mouse cursor
|
// mouse cursor
|
||||||
|
|
||||||
if (IsFocus()) {
|
if (view != NULL) {
|
||||||
// TODO: there is more for real cursor support, ie. if a window is closed,
|
// TODO: there is more for real cursor support, ie. if a window is closed,
|
||||||
// new app cursor shouldn't override view cursor, ...
|
// new app cursor shouldn't override view cursor, ...
|
||||||
ServerWindow()->App()->SetCurrentCursor(view != NULL ? view->Cursor() : NULL);
|
ServerWindow()->App()->SetCurrentCursor(view->Cursor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user