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@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
This commit is contained in:
parent
8c6e24b565
commit
9142828282
2 changed files with 25 additions and 11 deletions
|
@ -1242,15 +1242,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, 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;
|
||||
|
@ -1260,7 +1270,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;
|
||||
}
|
||||
|
|
|
@ -706,9 +706,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);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue