From 91e3b80197cfa6b624c216ce61298ce1463ba4f8 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 1 Nov 2014 10:04:01 +0100 Subject: [PATCH] {app|input}_server: Provide app_server team id to input_server. For cases where a BMessage is passed by area, the remote team id needs to be passed into BMessage::_SendMessage() so it can transfer the area to the target team. It falls back to detecting the port owner if said information is missing. However, since the input_server owns the port in this situation, the remote team needs to be specified explicitly. Add the app_server team id to the input acquire message, so input_server gets the needed info. As messages that exceed the pass by area threshold are rather rare in general and shouldn't happen at all in this situation, this does not fix any immediate problem. --- src/servers/app/EventStream.cpp | 4 ++++ src/servers/input/InputServer.cpp | 7 ++++++- src/servers/input/InputServer.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/servers/app/EventStream.cpp b/src/servers/app/EventStream.cpp index 6eb6352b9a..9643262319 100644 --- a/src/servers/app/EventStream.cpp +++ b/src/servers/app/EventStream.cpp @@ -13,6 +13,8 @@ #include #include +#include + #include #include #include @@ -53,6 +55,8 @@ InputServerStream::InputServerStream(BMessenger& messenger) fLatestMouseMoved(NULL) { BMessage message(IS_ACQUIRE_INPUT); + message.AddInt32("remote team", BPrivate::current_team()); + fCursorArea = create_area("shared cursor", (void **)&fCursorBuffer, B_ANY_ADDRESS, B_PAGE_SIZE, B_LAZY_LOCK, B_READ_AREA | B_WRITE_AREA); if (fCursorArea >= B_OK) diff --git a/src/servers/input/InputServer.cpp b/src/servers/input/InputServer.cpp index c81832a4ee..bb74f9b9c7 100644 --- a/src/servers/input/InputServer.cpp +++ b/src/servers/input/InputServer.cpp @@ -153,6 +153,7 @@ InputServer::InputServer() fInputMethodAware(false), fCursorSem(-1), fAppServerPort(-1), + fAppServerTeam(-1), fCursorArea(-1) { CALLED(); @@ -394,6 +395,9 @@ InputServer::_AcquireInput(BMessage& message, BMessage& reply) } } + if (message.FindInt32("remote team", &fAppServerTeam) != B_OK) + fAppServerTeam = -1; + fAppServerPort = create_port(200, "input server target"); if (fAppServerPort < B_OK) { _ReleaseInput(&message); @@ -1836,7 +1840,8 @@ InputServer::_DispatchEvent(BMessage* event) BMessenger reply; BMessage::Private messagePrivate(event); - return messagePrivate.SendMessage(fAppServerPort, -1, 0, 0, false, reply); + return messagePrivate.SendMessage(fAppServerPort, fAppServerTeam, 0, 0, + false, reply); } diff --git a/src/servers/input/InputServer.h b/src/servers/input/InputServer.h index cff913d767..2466d6b85f 100644 --- a/src/servers/input/InputServer.h +++ b/src/servers/input/InputServer.h @@ -243,6 +243,7 @@ class InputServer : public BApplication { sem_id fCursorSem; port_id fAppServerPort; + team_id fAppServerTeam; area_id fCursorArea; shared_cursor* fCursorBuffer; };