[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - kit/ChildSession.cpp loleaflet/src
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 17 18:21:19 UTC 2020
kit/ChildSession.cpp | 32 ++++++++++++++++++++++++--------
loleaflet/src/layer/marker/TextInput.js | 4 +---
2 files changed, 25 insertions(+), 11 deletions(-)
New commits:
commit bda31ada6962147984f39f2c37c1c7fb4933058e
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Wed Aug 5 17:16:08 2020 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 17 20:20:59 2020 +0200
textinput: use a single input message per key on the wire.
Change-Id: Ibd0f7afb98c8ed278751c4b5b46d7ce2467cd71f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100184
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100663
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 8d1fef6fb..7f6dbaa8b 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1245,15 +1245,25 @@ bool ChildSession::insertFile(const char* /*buffer*/, int /*length*/, const Stri
bool ChildSession::extTextInputEvent(const char* /*buffer*/, int /*length*/,
const StringVector& tokens)
{
- int id, type;
+ int id = -1, type = -1;
std::string text;
- if (tokens.size() < 4 ||
- !getTokenInteger(tokens[1], "id", id) || id < 0 ||
- !getTokenKeyword(tokens[2], "type",
- {{"input", LOK_EXT_TEXTINPUT}, {"end", LOK_EXT_TEXTINPUT_END}},
- type) ||
- !getTokenString(tokens[3], "text", text))
+ bool error = false;
+
+ if (tokens.size() < 3)
+ error = true;
+ else if (!getTokenInteger(tokens[1], "id", id) || id < 0)
+ error = true;
+ else {
+ // back-compat 'type'
+ if (getTokenKeyword(tokens[2], "type",
+ {{"input", LOK_EXT_TEXTINPUT}, {"end", LOK_EXT_TEXTINPUT_END}},
+ type))
+ error = !getTokenString(tokens[3], "text", text);
+ else // normal path:
+ error = !getTokenString(tokens[2], "text", text);
+ }
+ if (error)
{
sendTextFrameAndLogError("error: cmd=" + std::string(tokens[0]) + " kind=syntax");
return false;
@@ -1263,7 +1273,13 @@ bool ChildSession::extTextInputEvent(const char* /*buffer*/, int /*length*/,
URI::decode(text, decodedText);
getLOKitDocument()->setView(_viewId);
- getLOKitDocument()->postWindowExtTextInputEvent(id, type, decodedText.c_str());
+ if (type >= 0)
+ getLOKitDocument()->postWindowExtTextInputEvent(id, type, decodedText.c_str());
+ else
+ {
+ getLOKitDocument()->postWindowExtTextInputEvent(id, LOK_EXT_TEXTINPUT, decodedText.c_str());
+ getLOKitDocument()->postWindowExtTextInputEvent(id, LOK_EXT_TEXTINPUT_END, decodedText.c_str());
+ }
return true;
}
diff --git a/loleaflet/src/layer/marker/TextInput.js b/loleaflet/src/layer/marker/TextInput.js
index 801c9d368..9fe093ce7 100644
--- a/loleaflet/src/layer/marker/TextInput.js
+++ b/loleaflet/src/layer/marker/TextInput.js
@@ -740,9 +740,7 @@ L.TextInput = L.Layer.extend({
var encodedText = encodeURIComponent(text);
var winId = this._map.getWinId();
this._map._socket.sendMessage(
- 'textinput id=' + winId + ' type=input text=' + encodedText);
- this._map._socket.sendMessage(
- 'textinput id=' + winId + ' type=end text=' + encodedText);
+ 'textinput id=' + winId + ' text=' + encodedText);
}
},
More information about the Libreoffice-commits
mailing list