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>
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 64ad4f7..ca23138 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -514,6 +514,8 @@
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 @@
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::focusOutEvent(QFocusEvent*)
{
m_rFrame.m_nKeyModifiers = ModKeyFlags::NONE;
endExtTextInput();
m_rFrame.CallCallback(SalEvent::LoseFocus, nullptr);
closePopup();