From 860678c2c76d8d090f1a8ee08acd14ebf71f64d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Fri, 28 Nov 2008 20:05:38 +0000 Subject: [PATCH] At some point, there was some hassle about what coordinate system the "where" BPoint in a mouse moved message is. Turns out it's different (!) according to the type of message and this is even documented in the BeBook. I don't really know if we want to copy this, but since there are apps out there that depend on this, I am implementing it so that it's compatible with BeOS: In the B_MOUSE_UP/DOWN case, it's the coordinate space of the target view, in B_MOUSE_MOVED messages, it's that of the window. That explains a few things... Clicking into Pe's function popup window should now select the right icon. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28742 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Window.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 1b6a7e1dec..4914a41f4b 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -3152,14 +3152,24 @@ BWindow::_SanitizeMessage(BMessage* message, BHandler* target, bool usePreferred if (message->FindPoint("screen_where", &where) != B_OK) break; - // add local window coordinates - message->AddPoint("where", ConvertFromScreen(where)); - BView* view = dynamic_cast(target); + + if (!view || message->what == B_MOUSE_MOVED) { + // add local window coordinates, only + // for regular mouse moved messages + message->AddPoint("where", ConvertFromScreen(where)); + } + if (view != NULL) { // add local view coordinates - message->AddPoint("be:view_where", - view->ConvertFromScreen(where)); + BPoint viewWhere = view->ConvertFromScreen(where); + if (message->what != B_MOUSE_MOVED) { + // Yep, the meaning of "where" is different + // for regular mouse moved messages versus + // mouse up/down! + message->AddPoint("where", viewWhere); + } + message->AddPoint("be:view_where", viewWhere); if (message->what == B_MOUSE_MOVED) { // is there a token of the view that is currently under