Implemented private function BWindow::DequeueAll() which reads all pending

messages from the port.
BView::GetMouse() now calls this function if it was called from the window's
thread and thus blocking the message loop.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12716 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-05-18 16:54:56 +00:00
parent 25b0ec461d
commit 3405fff2a9
2 changed files with 24 additions and 7 deletions
+17 -1
View File
@@ -2316,7 +2316,23 @@ void BWindow::InitData( BRect frame, const char* title, window_look look,
BuildTopView();
}
//------------------------------------------------------------------------------
/** Reads all pending messages from the window port and put them into the queue.
*/
void
BWindow::DequeueAll()
{
// Get message count from port
int32 count = port_count(fMsgPort);
for (int32 i = 0; i < count; i++) {
BMessage *message = MessageFromPort(0);
if (message != NULL)
fQueue->AddMessage(message);
}
}
// TODO: This here is a nearly full code duplication to BLooper::task_loop
// but with one little difference: It uses the determine_target function