loolwsd/ChildProcessSession.cpp | 31 +++++++++++++++++++++++++++++++ loolwsd/ChildProcessSession.hpp | 1 + loolwsd/MasterProcessSession.cpp | 1 + loolwsd/protocol.txt | 4 ++++ 4 files changed, 37 insertions(+)
New commits: commit aa450a0c3887dfee75262816ec29a9e28f48f7bf Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Feb 2 11:48:41 2016 +0100 loolwsd: add clientvisiblearea client -> server command diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp index bc5f182..2ebe1ff 100644 --- a/loolwsd/ChildProcessSession.cpp +++ b/loolwsd/ChildProcessSession.cpp @@ -451,6 +451,7 @@ bool ChildProcessSession::_handleInput(const char *buffer, int length) // i.e. need to be handled in a child process. assert(tokens[0] == "clientzoom" || + tokens[0] == "clientvisiblearea" || tokens[0] == "disconnect" || tokens[0] == "downloadas" || tokens[0] == "getchildid" || @@ -482,6 +483,10 @@ bool ChildProcessSession::_handleInput(const char *buffer, int length) { return clientZoom(buffer, length, tokens); } + else if (tokens[0] == "clientvisiblearea") + { + return clientVisibleArea(buffer, length, tokens); + } else if (tokens[0] == "disconnect") { // This was the last we would hear from the client on this socket. @@ -899,6 +904,32 @@ bool ChildProcessSession::clientZoom(const char* /*buffer*/, int /*length*/, Str return true; } +bool ChildProcessSession::clientVisibleArea(const char* /*buffer*/, int /*length*/, StringTokenizer& tokens) +{ + int x; + int y; + int width; + int height; + + if (tokens.count() != 5 || + !getTokenInteger(tokens[1], "x", x) || + !getTokenInteger(tokens[2], "y", y) || + !getTokenInteger(tokens[3], "width", width) || + !getTokenInteger(tokens[4], "height", height)) + { + sendTextFrame("error: cmd=clientvisiblearea kind=syntax"); + return false; + } + + std::unique_lock<std::recursive_mutex> lock(Mutex); + + if (_multiView) + _loKitDocument->pClass->setView(_loKitDocument, _viewId); + + _loKitDocument->pClass->setClientVisibleArea(_loKitDocument, x, y, width, height); + return true; +} + bool ChildProcessSession::downloadAs(const char* /*buffer*/, int /*length*/, StringTokenizer& tokens) { std::string name, id, format, filterOptions; diff --git a/loolwsd/ChildProcessSession.hpp b/loolwsd/ChildProcessSession.hpp index fb622dd..3e7c957 100644 --- a/loolwsd/ChildProcessSession.hpp +++ b/loolwsd/ChildProcessSession.hpp @@ -99,6 +99,7 @@ public: virtual void sendFontRendering(const char *buffer, int length, Poco::StringTokenizer& tokens) override; bool clientZoom(const char *buffer, int length, Poco::StringTokenizer& tokens); + bool clientVisibleArea(const char *buffer, int length, Poco::StringTokenizer& tokens); bool downloadAs(const char *buffer, int length, Poco::StringTokenizer& tokens); bool getChildId(); bool getTextSelection(const char *buffer, int length, Poco::StringTokenizer& tokens); diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp index c8b1642..4054f3c 100644 --- a/loolwsd/MasterProcessSession.cpp +++ b/loolwsd/MasterProcessSession.cpp @@ -285,6 +285,7 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length) } else if (tokens[0] != "canceltiles" && tokens[0] != "clientzoom" && + tokens[0] != "clientvisiblearea" && tokens[0] != "commandvalues" && tokens[0] != "disconnect" && tokens[0] != "downloadas" && diff --git a/loolwsd/protocol.txt b/loolwsd/protocol.txt index 619a32a..7bb32d9 100644 --- a/loolwsd/protocol.txt +++ b/loolwsd/protocol.txt @@ -131,6 +131,10 @@ partpagerectangles Invokes lok::Document::getPartPageRectangles(). +clientvisiblearea x=<x> y=<y> width=<width> height=<height> + + Invokes lok::Document::setClientVisibleArea(). + server -> client ================ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits