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:
John Scipione 2013-12-13 02:21:10 -05:00
parent 8f5d92f98d
commit dd0bdb49dc
2 changed files with 7 additions and 3 deletions

View File

@ -4324,8 +4324,12 @@ BView::MessageReceived(BMessage* message)
case B_MOUSE_IDLE:
{
BPoint where;
if (message->FindPoint("be:view_where", &where) != B_OK)
break;
if (message->FindPoint("be:view_where", &where) != B_OK) {
if (message->FindPoint("screen_where", &where) != B_OK)
break;
else
ConvertFromScreen(&where);
}
BToolTip* tip;
if (GetToolTipAt(where, &tip))

View File

@ -1028,7 +1028,7 @@ EventDispatcher::_CursorLoop()
} else if (status == B_TIMED_OUT) {
mouseIdleSent = true;
BMessage* mouseIdle = new BMessage(B_MOUSE_IDLE);
mouseIdle->AddPoint("be:view_where", fLastCursorPosition);
mouseIdle->AddPoint("screen_where", fLastCursorPosition);
fStream->InsertEvent(mouseIdle);
}
}