Finally fixed Adi's repeatedly mentioned pet peeve: in AS_LAYER_GET_MOUSE_COORDS

communication, the port's reply port is no longer sent to the app_server (as it
knows where to reply to, anyway).
Also made sure the view's looper is locked while getting the coords - I guess
BPortLink doesn't like to be written to from two different threads :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12742 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-05-20 02:42:52 +00:00
parent 9962b67e5f
commit 52005fdaff
2 changed files with 17 additions and 26 deletions
+11 -21
View File
@@ -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<port_id>(&replyport);
int32 buttons=desktop->ActiveRootLayer()->Buttons();
BPortLink replylink(replyport);
replylink.StartMessage(SERVER_TRUE);
replylink.Attach<BPoint>(desktop->GetDisplayDriver()->GetCursorPosition());
replylink.Attach<int32>(buttons);
replylink.Flush();
fMsgSender->Attach<BPoint>(desktop->GetDisplayDriver()->GetCursorPosition());
fMsgSender->Attach<int32>(desktop->ActiveRootLayer()->Buttons());
fMsgSender->Flush();
break;
}
default:
{
DispatchGraphicsMessage(code, link);
}
break;
}
}
// -------------------- Graphics messages ----------------------------------