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:
@@ -1172,19 +1172,20 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue)
|
||||
{
|
||||
do_owner_check();
|
||||
|
||||
// ToDo: We should check if we are calling this from the BWindow's thread or not.
|
||||
// But why exactly do we have to do this? If the looper is locked, it
|
||||
// shouldn't do too much harm, besides, who would do this, anyway :) -- axeld.
|
||||
|
||||
if (checkMessageQueue) {
|
||||
BMessageQueue *queue = Window()->MessageQueue();
|
||||
BMessage *msg;
|
||||
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();
|
||||
queue->Lock();
|
||||
|
||||
// First process and remove all _UPDATE_ messages
|
||||
// ToDo: it would be great to join them together to one big update message!
|
||||
|
||||
BMessage *msg;
|
||||
for (int32 i = 0; (msg = queue->FindMessage(i)) != NULL; ) {
|
||||
if (msg->what == _UPDATE_) {
|
||||
Window()->BWindow::DispatchMessage(msg, Window());
|
||||
|
||||
Reference in New Issue
Block a user