[Libreoffice-commits] online.git: loolwsd/LOOLSession.cpp loolwsd/protocol.txt
Tor Lillqvist
tml at collabora.com
Thu May 28 23:46:52 PDT 2015
loolwsd/LOOLSession.cpp | 21 +++++++++++++++++++--
loolwsd/protocol.txt | 17 ++++++++++++++++-
2 files changed, 35 insertions(+), 3 deletions(-)
New commits:
commit a608aaee90db0d045bd8fa4713c6fa31dd47bd1e
Author: Tor Lillqvist <tml at collabora.com>
Date: Fri May 29 09:44:39 2015 +0300
Add an invalidate: message that is in LOOL style with named parameters
The invalidatetiles: message as generated directly from the
LOK_CALLBACK_INVALIDATE_TILES will be dropped soon.
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 3716492..9843832 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -736,8 +736,25 @@ extern "C"
switch ((LibreOfficeKitCallbackType) nType)
{
case LOK_CALLBACK_INVALIDATE_TILES:
- srv->sendTextFrame("curpart: part=" + std::to_string(srv->_loKitDocument->pClass->getPart(srv->_loKitDocument)));
- srv->sendTextFrame("invalidatetiles: " + std::string(pPayload));
+ {
+ int curPart = srv->_loKitDocument->pClass->getPart(srv->_loKitDocument);
+ srv->sendTextFrame("curpart: part=" + std::to_string(curPart));
+ srv->sendTextFrame("invalidatetiles: " + std::string(pPayload));
+ StringTokenizer tokens(std::string(pPayload), " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
+ if (tokens.count() == 4)
+ {
+ int width(std::stoi(tokens[0]));
+ int height(std::stoi(tokens[1]));
+ int x(std::stoi(tokens[2]));
+ int y(std::stoi(tokens[3]));
+ srv->sendTextFrame("invalidate:"
+ " part=" + std::to_string(curPart) +
+ " x=" + std::to_string(x) +
+ " y=" + std::to_string(y) +
+ " width=" + std::to_string(width) +
+ " height=" + std::to_string(height));
+ }
+ }
break;
case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR:
srv->sendTextFrame("invalidatecursor: " + std::string(pPayload));
diff --git a/loolwsd/protocol.txt b/loolwsd/protocol.txt
index adb5950..82d3b90 100644
--- a/loolwsd/protocol.txt
+++ b/loolwsd/protocol.txt
@@ -66,10 +66,25 @@ error: cmd=<command> kind=<kind>
message that caused the error. <kind> is some single-word
classification
+invalidate: part=<partNumber> x=<x> y=<y> width=<width> height=<height>
+
+ All parameters are numbers. Tells the client to invalidate any
+ cached tiles for the document area specified (in twips), at any
+ zoom level.
+
+ The client should handle either this message or the
+ invalidatetiles: message, which has a different syntax, with
+ payload directly from the LOK_CALLBACK_INVALIDATE_TILES
+ callback. (The latter does not contain a part number, and as the
+ protocol is asynchronous, it is unclear whether a client can be
+ sure, or find out with certainty, for what part the
+ invalidatetiles: message is. The invalidatetiles: message will be
+ dropped soon.)
+
nextmessage: size=<byteSize>
<byteSize> is the size, in bytes, of the next message, in case it
- is "large" (in practise, nextmessage: messages precede each tile:
+ is "large". (In practice, nextmessage: messages precede each tile:
message). Can be ignored by clients using an API that can read
arbitrarily large buffers from a WebSocket (like JavaScript), but
must be handled by clients that cannot (like those using Poco
More information about the Libreoffice-commits
mailing list