loolwsd/ChildSession.cpp | 12 ++++++------ loolwsd/LOOLKit.cpp | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-)
New commits: commit ce832fbc114b7ddcf8fc7802a6a42d6a62254cd5 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Sun Oct 2 16:44:11 2016 -0400 loolwsd: get the invalidated part from the callback directly By default LOK doesn't provide the part where the invalidated tile is. The part # is found using API, but due to the fact that callbacks are processed asynchronously, the part # may well have changed by the time the invalidation is processed. This could result in buggy invalidations where no modification took place. With the new API flag LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK the part # is included in the callback, which is parsed and used to inform the client with the correct part #. Change-Id: Ibd85764bfdc41ebf1aae490df335bd503284ae91 Reviewed-on: https://gerrit.libreoffice.org/29467 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loolwsd/ChildSession.cpp b/loolwsd/ChildSession.cpp index 1d39b17..81e5c8d 100644 --- a/loolwsd/ChildSession.cpp +++ b/loolwsd/ChildSession.cpp @@ -977,18 +977,17 @@ void ChildSession::loKitCallback(const int nType, const std::string& rPayload) { case LOK_CALLBACK_INVALIDATE_TILES: { - const auto curPart = _loKitDocument->getPart(); - - StringTokenizer tokens(rPayload, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); - if (tokens.count() == 4) + StringTokenizer tokens(rPayload, ",", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); + if (tokens.count() == 5) { - int x, y, width, height; + int part, x, y, width, height; try { x = std::stoi(tokens[0]); y = std::stoi(tokens[1]); width = std::stoi(tokens[2]); height = std::stoi(tokens[3]); + part = std::stoi(tokens[4]); } catch (const std::out_of_range&) { @@ -998,10 +997,11 @@ void ChildSession::loKitCallback(const int nType, const std::string& rPayload) y = 0; width = INT_MAX; height = INT_MAX; + part = 0; } sendTextFrame("invalidatetiles:" - " part=" + std::to_string(curPart) + + " part=" + std::to_string(part) + " x=" + std::to_string(x) + " y=" + std::to_string(y) + " width=" + std::to_string(width) + diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp index f73de13..33a4921 100644 --- a/loolwsd/LOOLKit.cpp +++ b/loolwsd/LOOLKit.cpp @@ -1105,7 +1105,8 @@ private: { _loKit->get()->pClass->registerCallback(_loKit->get(), GlobalCallback, this); const auto flags = LOK_FEATURE_DOCUMENT_PASSWORD - | LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY; + | LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY + | LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK; _loKit->setOptionalFeatures(flags); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits