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& 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 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& 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& tokens); bool selectGraphic(const char* buffer, int length, const std::vector& tokens); bool renderWindow(const char* buffer, int length, const std::vector& tokens); + bool resizeWindow(const char* buffer, int length, const std::vector& tokens); bool resetSelection(const char* buffer, int length, const std::vector& tokens); bool saveAs(const char* buffer, int length, const std::vector& tokens); bool setClientPart(const char* buffer, int length, const std::vector& 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) diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index 328d1d1fc..2623f3585 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -425,7 +425,8 @@ bool ClientSession::_handleInput(const char *buffer, int length) tokens[0] != "exportsignanduploaddocument" && tokens[0] != "rendershapeselection" && tokens[0] != "removesession" && - tokens[0] != "renamefile") + tokens[0] != "renamefile" && + tokens[0] != "resizewindow") { LOG_ERR("Session [" << getId() << "] got unknown command [" << tokens[0] << "]."); sendTextFrame("error: cmd=" + tokens[0] + " kind=unknown"); @@ -1118,7 +1119,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt } else return false; - } + } } #if !MOBILEAPP else if (tokens.size() == 3 && tokens[0] == "saveas:")