diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-04-30 11:30:12 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-04-30 17:36:05 +0200 |
commit | 63a62abae01e7beb15d1e7cb12c469b42253bf1b (patch) | |
tree | fbec1f87d5cf7c735725196220d6ff00e8c77599 /vcl | |
parent | 691c61146d3d627d24fec336550a0d4933549cda (diff) |
tdf#160838 qt: Update IM cursor position also on modifier change
In `QtWidget::handleKeyEvent`, move the call to
QGuiApplication::inputMethod()->update(Qt::ImCursorRectangle);
further up, so the cursor update also happens for the code path
of calling the `SalEvent::KeyModChange` callback and then returning
early.
This makes fcitx5's keyboard layout indicator show up at the right
position again when switching layout right after starting Writer
(s. tdf#160838 comment comment 2), which was no longer the case
after the new code path had been introduced in
commit 862fdb98ca271b60a831cd5420fd16d5f9c1c747
Date: Mon Jul 19 15:17:53 2021 +0200
tdf#143298 Qt5 send SalEvent::KeyModChange events
(Not sure whether it wouldn't even make more sense
to update *after* processing the key event for the
case that actual text is typed, as that presumably
modifies the cursor position, but leave the logic
otherwise unchanged for now.)
Change-Id: I6e21ae51568eefc8e2ae64109d5596f5e20cc28a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166923
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qt5/QtWidget.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index 996a0a7cc9ce..5c860333793f 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -580,6 +580,8 @@ bool QtWidget::handleKeyEvent(QtFrame& rFrame, const QWidget& rWidget, QKeyEvent return true; } + QGuiApplication::inputMethod()->update(Qt::ImCursorRectangle); + if (nCode == 0 && pEvent->text().isEmpty()) { sal_uInt16 nModCode = GetKeyModCode(pEvent->modifiers()); @@ -669,8 +671,6 @@ bool QtWidget::handleKeyEvent(QtFrame& rFrame, const QWidget& rWidget, QKeyEvent aEvent.mnCode = nCode; aEvent.mnCode |= GetKeyModCode(pEvent->modifiers()); - QGuiApplication::inputMethod()->update(Qt::ImCursorRectangle); - bool bStopProcessingKey; if (bIsKeyPressed) bStopProcessingKey = rFrame.CallCallback(SalEvent::KeyInput, &aEvent); |