diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-10-21 19:32:41 -0400 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2019-09-03 01:53:12 -0400 |
commit | 30c3de53f71290ee637a13ef73169a538b3bc96e (patch) | |
tree | 85ff7f0ba03679c4a6d722de62fd5caed262772c /kit | |
parent | d7ed6988fbb872926b0789d0fb907f629b1f4754 (diff) |
wsd: support resizing of the sidebar
(cherry picked from commit d3a900d3484e4e6690d8c625f1edc73289baba4d)
Change-Id: If7d7b356563f503dfedfb0686c1d1b5be9b7b221
Diffstat (limited to 'kit')
-rw-r--r-- | kit/ChildSession.cpp | 24 | ||||
-rw-r--r-- | kit/ChildSession.hpp | 1 | ||||
-rw-r--r-- | kit/Kit.cpp | 2 |
3 files changed, 26 insertions, 1 deletions
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp index b1bee8ccf..371bc4cd4 100644 --- a/kit/ChildSession.cpp +++ b/kit/ChildSession.cpp @@ -248,6 +248,10 @@ bool ChildSession::_handleInput(const char *buffer, int length) { return renderWindow(buffer, length, tokens); } + else if (tokens[0] == "resizewindow") + { + return resizeWindow(buffer, length, tokens); + } else if (tokens[0] == "tile" || tokens[0] == "tilecombine") { assert(false && "Tile traffic should go through the DocumentBroker-LoKit WS."); @@ -1489,6 +1493,26 @@ bool ChildSession::renderWindow(const char* /*buffer*/, int /*length*/, const st return true; } +bool ChildSession::resizeWindow(const char* /*buffer*/, int /*length*/, const std::vector<std::string>& tokens) +{ + const unsigned winId = (tokens.size() > 1 ? std::stoul(tokens[1].c_str(), nullptr, 10) : 0); + + getLOKitDocument()->setView(_viewId); + + std::string size; + if (tokens.size() > 2 && getTokenString(tokens[2], "size", size)) + { + const std::vector<int> sizeParts = LOOLProtocol::tokenizeInts(size, ','); + if (sizeParts.size() == 2) + { + getLOKitDocument()->resizeWindow(winId, sizeParts[0], sizeParts[1]); + return true; + } + } + + LOG_WRN("resizewindow command doesn't specify sensible size= attribute."); + return true; +} bool ChildSession::sendWindowCommand(const char* /*buffer*/, int /*length*/, const std::vector<std::string>& tokens) { diff --git a/kit/ChildSession.hpp b/kit/ChildSession.hpp index bd0d12a1c..cbaaba54b 100644 --- a/kit/ChildSession.hpp +++ b/kit/ChildSession.hpp @@ -261,6 +261,7 @@ private: bool selectText(const char* buffer, int length, const std::vector<std::string>& tokens); bool selectGraphic(const char* buffer, int length, const std::vector<std::string>& tokens); bool renderWindow(const char* buffer, int length, const std::vector<std::string>& tokens); + bool resizeWindow(const char* buffer, int length, const std::vector<std::string>& tokens); bool resetSelection(const char* buffer, int length, const std::vector<std::string>& tokens); bool saveAs(const char* buffer, int length, const std::vector<std::string>& tokens); bool setClientPart(const char* buffer, int length, const std::vector<std::string>& tokens); diff --git a/kit/Kit.cpp b/kit/Kit.cpp index a167ae513..beebb8aa2 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -2279,7 +2279,7 @@ protected: document.reset(); } else if (tokens[0] == "tile" || tokens[0] == "tilecombine" || tokens[0] == "canceltiles" || - tokens[0] == "paintwindow" || + tokens[0] == "paintwindow" || tokens[0] == "resizewindow" || LOOLProtocol::getFirstToken(tokens[0], '-') == "child") { if (document) |