loolwsd: add support for postMouseEvent's targetwindow

(cherry picked from commit b45e3fa5becf8fcbf106cb6b944c8f4709563d43)
This commit is contained in:
Andrzej Hunt 2015-11-30 12:14:33 -08:00 committed by Andras Timar
parent 9bcde92f50
commit d1b39e39e8

View file

@ -1372,8 +1372,9 @@ bool ChildProcessSession::keyEvent(const char* /*buffer*/, int /*length*/, Strin
bool ChildProcessSession::mouseEvent(const char* /*buffer*/, int /*length*/, StringTokenizer& tokens)
{
int type, x, y, count, buttons, modifier;
std::string targetwindow;
if (tokens.count() != 7 ||
if (((tokens.count() != 7 && tokens.count() != 8)) ||
!getTokenKeyword(tokens[1], "type",
{{"buttondown", LOK_MOUSEEVENT_MOUSEBUTTONDOWN},
{"buttonup", LOK_MOUSEEVENT_MOUSEBUTTONUP},
@ -1389,7 +1390,14 @@ bool ChildProcessSession::mouseEvent(const char* /*buffer*/, int /*length*/, Str
return false;
}
_loKitDocument->pClass->postMouseEvent(_loKitDocument, type, x, y, count, buttons, modifier);
// target window parameter is optional - LOK assumes
// document if not specified.
if (tokens.count() == 8)
{
getTokenString(tokens[7], "targetwindow", targetwindow);
}
_loKitDocument->pClass->postMouseEvent(_loKitDocument, type, x, y, count, buttons, modifier, targetwindow.c_str());
return true;
}