diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2021-09-10 12:02:20 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2021-09-10 18:56:46 +0200 |
commit | 61cb81d67ebf6b342a1cdb46bf6eb25a49eb5ff4 (patch) | |
tree | bcaaf5e6460fb2c9c6c4db993092aa93955aa52a /vcl | |
parent | ccea340276609c87384ee7fff4837e48baaba9b5 (diff) |
tdf#144412 Qt5 reset m_nModKeyCode on key input
Switching the input direction on Ctrl + L/R-Shift is actually no
bug but a feature. It is triggered on key release, so it can be
distinguished from / doesn't interfere with shortcut handling.
That's what should happen.
So trying to implement that behaviour correctly and seeing the
appearingly wrong modifier events for gtk3, I found gtk3 resets
the frames persistent mnModKeyCode for key input events, which
also seems to fix the problem for qt5.
Some additional discussion is also in tdf#103158.
Regression from commit 862fdb98ca271b60a831cd5420fd16d5f9c1c747
("tdf#143298 Qt5 send SalEvent::KeyModChange events").
Change-Id: Iafcd1db7abcdf078001ca0602ae6e374f2a169ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121858
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qt5/Qt5Widget.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx index 64ad4f7539c4..ca23138b5739 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -514,6 +514,8 @@ bool Qt5Widget::handleKeyEvent(Qt5Frame& rFrame, const QWidget& rWidget, QKeyEve if (eState == ButtonKeyState::Released) { + // sending the old mnModKeyCode mask on release is needed to + // implement the writing direction switch with Ctrl + L/R-Shift aModEvt.mnModKeyCode = rFrame.m_nKeyModifiers; nModCode &= ~nModMask; rFrame.m_nKeyModifiers &= ~nExtModMask; @@ -532,6 +534,9 @@ bool Qt5Widget::handleKeyEvent(Qt5Frame& rFrame, const QWidget& rWidget, QKeyEve return false; } + // prevent interference of writing direction switch (Ctrl + L/R-Shift) with "normal" shortcuts + rFrame.m_nKeyModifiers = ModKeyFlags::NONE; + SalKeyEvent aEvent; aEvent.mnCharCode = (pEvent->text().isEmpty() ? 0 : pEvent->text().at(0).unicode()); aEvent.mnRepeat = 0; @@ -605,6 +610,7 @@ void Qt5Widget::closePopup() void Qt5Widget::focusOutEvent(QFocusEvent*) { + m_rFrame.m_nKeyModifiers = ModKeyFlags::NONE; endExtTextInput(); m_rFrame.CallCallback(SalEvent::LoseFocus, nullptr); closePopup(); |