Fixed BWindow::UpdateIfNeeded() by moving the code from BView::GetMouse() over.
GetMouse() will now just call UpdateIfNeeded(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12736 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
402612b831
commit
25500bdfd9
@ -1173,33 +1173,14 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue)
|
|||||||
do_owner_check();
|
do_owner_check();
|
||||||
|
|
||||||
if (checkMessageQueue) {
|
if (checkMessageQueue) {
|
||||||
if (find_thread(NULL) == Window()->Thread()) {
|
|
||||||
// If the event loop is not running right now (we're blocking it),
|
|
||||||
// we need to retrieve all messages that are pending on the port.
|
|
||||||
Window()->DequeueAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
BMessageQueue *queue = Window()->MessageQueue();
|
BMessageQueue *queue = Window()->MessageQueue();
|
||||||
queue->Lock();
|
queue->Lock();
|
||||||
|
|
||||||
// First process and remove any _UPDATE_ message in the queue
|
Window()->UpdateIfNeeded();
|
||||||
// According to Adi, there can only be one at a time
|
|
||||||
|
// Look out for mouse update messages
|
||||||
|
|
||||||
BMessage *msg;
|
BMessage *msg;
|
||||||
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
|
|
||||||
// here; for BWindow::DispatchMessage() we now exactly what
|
|
||||||
// will happen
|
|
||||||
queue->RemoveMessage(msg);
|
|
||||||
delete msg;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then look out for mouse update messages
|
|
||||||
|
|
||||||
for (int32 i = 0; (msg = queue->FindMessage(i)) != NULL; i++) {
|
for (int32 i = 0; (msg = queue->FindMessage(i)) != NULL; i++) {
|
||||||
switch (msg->what) {
|
switch (msg->what) {
|
||||||
case B_MOUSE_UP:
|
case B_MOUSE_UP:
|
||||||
|
@ -1270,22 +1270,29 @@ BWindow::UpdateIfNeeded()
|
|||||||
if (find_thread(NULL) != Thread())
|
if (find_thread(NULL) != Thread())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Since we're blocking the event loop, we need to retrieve
|
||||||
|
// all messages that are pending on the port.
|
||||||
|
DequeueAll();
|
||||||
|
|
||||||
BMessageQueue *queue = MessageQueue();
|
BMessageQueue *queue = MessageQueue();
|
||||||
queue->Lock();
|
queue->Lock();
|
||||||
|
|
||||||
// process all _UPDATE_ BMessages in message queue
|
// First process and remove any _UPDATE_ message in the queue
|
||||||
// we lock the queue because we don't want to be stuck in this
|
// According to Adi, there can only be one at a time
|
||||||
// function if there is a continuous stream of updates
|
|
||||||
BMessage *msg;
|
|
||||||
while ((msg = queue->FindMessage(_UPDATE_, 0))) {
|
|
||||||
// ToDo: combine messages if possible
|
|
||||||
Lock();
|
|
||||||
DispatchMessage(msg, this);
|
|
||||||
Unlock();
|
|
||||||
|
|
||||||
queue->RemoveMessage(msg);
|
BMessage *msg;
|
||||||
delete msg;
|
for (int32 i = 0; (msg = queue->FindMessage(i)) != NULL; i++) {
|
||||||
|
if (msg->what == _UPDATE_) {
|
||||||
|
BWindow::DispatchMessage(msg, this);
|
||||||
|
// we need to make sure that no overridden method is called
|
||||||
|
// here; for BWindow::DispatchMessage() we now exactly what
|
||||||
|
// will happen
|
||||||
|
queue->RemoveMessage(msg);
|
||||||
|
delete msg;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
queue->Unlock();
|
queue->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user