diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 2239a9e988..e31feebc9c 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -1205,15 +1205,14 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue) queue->Unlock(); } + // Since we're usually called locked, this is mainly needed + // in case we were called from another thread + LockLooper(); + // If no mouse update message has been found in the message queue, // 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 - owner->fLink->Attach(owner->fLink->GetReplyPort()); owner->fLink->Flush(); int32 rCode = SERVER_FALSE; @@ -1222,6 +1221,8 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue) owner->fLink->Read(location); owner->fLink->Read((int32 *)buttons, sizeof(int32)); } + + UnlockLooper(); } diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index 8f7ac18806..f9a25ba2c5 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -1487,34 +1487,24 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link) } case AS_LAYER_GET_MOUSE_COORDS: { - DTRACE(("ServerWindow %s: Message AS_GET_MOUSE_COORDS\n",fName)); - - // Attached Data: - // 1) port_id reply port - + DTRACE(("ServerWindow %s: Message AS_GET_MOUSE_COORDS\n", fName)); + + fMsgSender->StartMessage(SERVER_TRUE); + // Returns // 1) BPoint mouse location // 2) int32 button state - - // For now, it's unimplemented, but this is a synchronous call, so to prevent debugging of - // applications which make this call, we'll reply with a SERVER_FALSE until it is implemeneted - - port_id replyport; - link.Read(&replyport); - - int32 buttons=desktop->ActiveRootLayer()->Buttons(); - - BPortLink replylink(replyport); - replylink.StartMessage(SERVER_TRUE); - replylink.Attach(desktop->GetDisplayDriver()->GetCursorPosition()); - replylink.Attach(buttons); - replylink.Flush(); + + fMsgSender->Attach(desktop->GetDisplayDriver()->GetCursorPosition()); + fMsgSender->Attach(desktop->ActiveRootLayer()->Buttons()); + + fMsgSender->Flush(); break; } + default: - { DispatchGraphicsMessage(code, link); - } + break; } } // -------------------- Graphics messages ----------------------------------