From dd0bdb49dc5d2fdb37f29dd687cd2a406fd34ab7 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 13 Dec 2013 02:21:10 -0500 Subject: [PATCH] Fix a bug retreiving tooltips MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/kits/interface/View.cpp | 8 ++++++-- src/servers/app/EventDispatcher.cpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 16200bd7cc..dd7ea8c66f 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -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)) diff --git a/src/servers/app/EventDispatcher.cpp b/src/servers/app/EventDispatcher.cpp index 58bfc4386a..b45f3c9298 100644 --- a/src/servers/app/EventDispatcher.cpp +++ b/src/servers/app/EventDispatcher.cpp @@ -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); } }