From d6fad1d006525f3d0d40a63fa75ff91bd610c85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 19 May 2005 14:12:02 +0000 Subject: [PATCH] Changes due to Adi's insight: - there can only be one _UPDATE_ message at a time in the queue so we can stop searching after we hit the first one - mouse coordinates are always send in screen coordinates (unlike R5, which means this is a compatibility problem), so we need to convert them even for the current view. Apps should now work with the old synchronous controls method (even though their drawing updates look clumsy and are slow compared to asynchronous controls for whatever reason). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12730 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/View.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index e74c53125d..2ab491b4b0 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -1182,11 +1182,11 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue) BMessageQueue *queue = Window()->MessageQueue(); queue->Lock(); - // First process and remove all _UPDATE_ messages - // ToDo: it would be great to join them together to one big update message! + // First process and remove any _UPDATE_ message in the queue + // According to Adi, there can only be one at a time BMessage *msg; - for (int32 i = 0; (msg = queue->FindMessage(i)) != NULL; ) { + for (int32 i = 0; (msg = queue->FindMessage(i)) != NULL; i++) { if (msg->what == _UPDATE_) { Window()->BWindow::DispatchMessage(msg, Window()); // we need to make sure that no overridden method is called @@ -1194,8 +1194,8 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue) // will happen queue->RemoveMessage(msg); delete msg; - } else - i++; + break; + } } // Then look out for mouse update messages @@ -1209,8 +1209,9 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue) msg->FindPoint("where", location); msg->FindInt32("buttons", (int32 *)buttons); - // ToDo: if we're intercepting a mouse message for another - // view, the coordinates must be updated to fit + // ToDo: the "where" coordinates are screen coordinates + // unlike R5 - this might break applications! + ConvertFromScreen(location); queue->RemoveMessage(msg); delete msg; @@ -1227,7 +1228,7 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue) // we get the current mouse location and buttons from the app_server owner->fLink->StartMessage(AS_LAYER_GET_MOUSE_COORDS); - + // This is because BPortLink doesn't automatically attach the reply // port to a synchronous message. Bummer. // TODO: Fix BPortLink synchronous reply code