summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2020-02-28 09:05:17 +0100
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2020-02-28 12:04:19 +0100
commitb304ff4b7de22132d397df88cd99cea64159e24f (patch)
tree906de5e5a96745d07cdad71a766144976f366a13 /vcl
parenta9df22cb603b85f469f1f6dfc492362a08505beb (diff)
tdf#130071 tdf#127815 qt5: Use ExtTextInput only for multi-char key events
Only call the SalEvent::ExtTextInput callback for key input events if their text is longer than one character, in which case treating them as SalEvent::KeyInput would produce incorrect results, given that only the first character is set as the SalKeyEvent's mnCharCode below (s.a. tdf#124118). S.a. commit 61c8324394c690ced18ce692ab6d29c8031ad1a8 ("#88063# fixed event handling for redflag", 2001-06-12) which made events with text longer than 1 unicode char to be handled by SalEvent::ExtTextInput for the gen VCL plugin even if not in preedit mode. Process other key events by calling SalEvent::KeyInput callback, which e.g. makes shortcuts involving non-Latin characters (tdf#130071) and auto-insertion of non-breaking spaces when typing French text (tdf#127815) work. The gtk3 and gen VCL plugins also use the length of the text as one criterion to make a disctinction of whether to call SalEvent::ExtTextInput or SalEvent::KeyInput, s. GtkSalFrame::IMHandler::signalIMCommit and X11SalFrame::HandleKeyEvent. Those also take into account whether in preedit mode, but for the qt5 case, input method events when using e.g. ibus are handled in Qt5Widget::inputMethodEvent and the Qt5Widget::handleKeyEvent code path is not used anyway. Change-Id: I2f8925ea26a4fb5419226265c579242889e2a506 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89663 Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins (cherry picked from commit 1c6ea413cb01c0b482f87e625ba208eec230618a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89670 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qt5/Qt5Widget.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 8c3d15b14efa..12e9a54f7f4f 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -420,7 +420,7 @@ bool Qt5Widget::handleKeyEvent(Qt5Frame& rFrame, const QWidget& rWidget, QKeyEve
const ButtonKeyState eState)
{
sal_uInt16 nCode = GetKeyCode(pEvent->key(), pEvent->modifiers());
- if (eState == ButtonKeyState::Pressed && nCode == 0 && !pEvent->text().isEmpty()
+ if (eState == ButtonKeyState::Pressed && nCode == 0 && pEvent->text().length() > 1
&& rWidget.testAttribute(Qt::WA_InputMethodEnabled))
{
commitText(rFrame, pEvent->text());