[Libreoffice-commits] core.git: vcl/qt5

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 28 09:50:10 UTC 2020


 vcl/qt5/Qt5Widget.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1c6ea413cb01c0b482f87e625ba208eec230618a
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Feb 28 09:05:17 2020 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Fri Feb 28 10:49:31 2020 +0100

    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 at fbihome.de>
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 27b617a91568..02039c076361 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());


More information about the Libreoffice-commits mailing list