[Libreoffice-commits] online.git: wsd/ClientSession.cpp
Tamás Zolnai
tamas.zolnai at collabora.com
Fri Apr 13 09:15:16 UTC 2018
wsd/ClientSession.cpp | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
New commits:
commit 347c0705c20b98a787bb59902f57b6df0e104bb0
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
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/52796
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 12f30a8e5..00833bd05 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);
More information about the Libreoffice-commits
mailing list