wsd/ClientSession.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
New commits: commit 6136cc34d679c409da2506ed5fe96394f2c7ca41 Author: Tamás Zolnai <[email protected]> Date: Thu Apr 12 20:28:54 2018 +0200 Update dumper code to handle new payload for invalidatecursor Change-Id: Ibfe129ce4db9ff33d409fb6ebabfb3a435b64829 Reviewed-on: https://gerrit.libreoffice.org/52804 Reviewed-by: Jan Holesovsky <[email protected]> Tested-by: Jan Holesovsky <[email protected]> diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index b307e2e6b..77a6e075a 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -781,16 +781,23 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt else if (tokens[0] == "invalidatecursor:") { assert(firstLine.size() == static_cast<std::string::size_type>(length)); - StringTokenizer firstLineTokens(firstLine, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); + + const size_t index = firstLine.find_first_of('{'); + const std::string stringJSON = firstLine.substr(index); + Poco::JSON::Parser parser; + const Poco::Dynamic::Var result = parser.parse(stringJSON); + const auto& object = result.extract<Poco::JSON::Object::Ptr>(); + const std::string rectangle = object->get("rectangle").toString(); + StringTokenizer rectangleTokens(rectangle, ",", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); int x = 0, y = 0, w = 0, h = 0; - if (firstLineTokens.count() > 2 && - stringToInteger(firstLineTokens[1], x) && - stringToInteger(firstLineTokens[2], y)) + if (rectangleTokens.count() > 2 && + stringToInteger(rectangleTokens[0], x) && + stringToInteger(rectangleTokens[1], y)) { - if (firstLineTokens.count() > 3) + if (rectangleTokens.count() > 3) { - stringToInteger(firstLineTokens[3], w); - stringToInteger(firstLineTokens[4], h); + stringToInteger(rectangleTokens[2], w); + stringToInteger(rectangleTokens[3], h); } docBroker->invalidateCursor(x, y, w, h); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
