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
This commit is contained in:
Axel Dörfler
2005-05-19 14:12:02 +00:00
parent 84987c7ad5
commit d6fad1d006
+8 -7
View File
@@ -1182,11 +1182,11 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue)
BMessageQueue *queue = Window()->MessageQueue(); BMessageQueue *queue = Window()->MessageQueue();
queue->Lock(); queue->Lock();
// First process and remove all _UPDATE_ messages // First process and remove any _UPDATE_ message in the queue
// ToDo: it would be great to join them together to one big update message! // According to Adi, there can only be one at a time
BMessage *msg; 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_) { if (msg->what == _UPDATE_) {
Window()->BWindow::DispatchMessage(msg, Window()); Window()->BWindow::DispatchMessage(msg, Window());
// we need to make sure that no overridden method is called // 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 // will happen
queue->RemoveMessage(msg); queue->RemoveMessage(msg);
delete msg; delete msg;
} else break;
i++; }
} }
// Then look out for mouse update messages // Then look out for mouse update messages
@@ -1209,8 +1209,9 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue)
msg->FindPoint("where", location); msg->FindPoint("where", location);
msg->FindInt32("buttons", (int32 *)buttons); msg->FindInt32("buttons", (int32 *)buttons);
// ToDo: if we're intercepting a mouse message for another // ToDo: the "where" coordinates are screen coordinates
// view, the coordinates must be updated to fit // unlike R5 - this might break applications!
ConvertFromScreen(location);
queue->RemoveMessage(msg); queue->RemoveMessage(msg);
delete msg; delete msg;