Fix a bug retreiving tooltips
Noticed this in Time prefs was displaying wrong time zone tool tip, dug deeper... hrev46290 introduced this bug because it passes fLastCursorPosition into the “be:view_where” parameter of the B_MOUSE_IDLE message. The problem is that fLastCursorPosition is in the screen’s coordinate system, not the view’s and BView expects “be:view_where” to be in the view’s coordinate system. So, to fix this I pass fLastCursorPosition in the “screen_where” parameter instead which I’ve instructed BView to interpret as the point in the screen’s coordinate system which is then dutifully converted back the the view’s coordinate system. I tried to follow the naming scheme of other code, not sure if screen_where should be namespaced with the be: predicate or not.
This commit is contained in:
@@ -4324,8 +4324,12 @@ BView::MessageReceived(BMessage* message)
|
|||||||
case B_MOUSE_IDLE:
|
case B_MOUSE_IDLE:
|
||||||
{
|
{
|
||||||
BPoint where;
|
BPoint where;
|
||||||
if (message->FindPoint("be:view_where", &where) != B_OK)
|
if (message->FindPoint("be:view_where", &where) != B_OK) {
|
||||||
break;
|
if (message->FindPoint("screen_where", &where) != B_OK)
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
ConvertFromScreen(&where);
|
||||||
|
}
|
||||||
|
|
||||||
BToolTip* tip;
|
BToolTip* tip;
|
||||||
if (GetToolTipAt(where, &tip))
|
if (GetToolTipAt(where, &tip))
|
||||||
|
|||||||
@@ -1028,7 +1028,7 @@ EventDispatcher::_CursorLoop()
|
|||||||
} else if (status == B_TIMED_OUT) {
|
} else if (status == B_TIMED_OUT) {
|
||||||
mouseIdleSent = true;
|
mouseIdleSent = true;
|
||||||
BMessage* mouseIdle = new BMessage(B_MOUSE_IDLE);
|
BMessage* mouseIdle = new BMessage(B_MOUSE_IDLE);
|
||||||
mouseIdle->AddPoint("be:view_where", fLastCursorPosition);
|
mouseIdle->AddPoint("screen_where", fLastCursorPosition);
|
||||||
fStream->InsertEvent(mouseIdle);
|
fStream->InsertEvent(mouseIdle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user