summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2020-02-17 10:38:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-02-17 15:45:45 +0100
commitcc4f16ca02c97847d05ee6479ae138a47db148f7 (patch)
tree908cd6fd1f462a098b24e0004bedf7daf2cb6827 /vcl
parentb0cdef796b235fdb7ed6414dba7499691ebd0b2c (diff)
tdf#126785 qt5: Ignore external QEvent::ShortcutOverride
For some reason, an extra external QEvent::ShortcutOverride event is triggered when a key is pressed and e.g. the Orca screen reader is enabled, which would result in duplicated input when handled as key input event as well. Therefore, ignore those ShortcutOverride events that are "spontaneous", i.e. "the event originated outside the application (a system event)". [1] [1] https://doc.qt.io/qt-5/qevent.html#spontaneous Change-Id: Ibccacb69c31d4d7ebd512c704f0e4df978c5281f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88852 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> (cherry picked from commit 034f56015c1c7a61faede33fb5306f63b5585632) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88791 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qt5/Qt5Widget.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 1fe4b505055f..8c0c5244c2bb 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -449,6 +449,16 @@ bool Qt5Widget::handleEvent(Qt5Frame& rFrame, const QWidget& rWidget, QEvent* pE
{
if (pEvent->type() == QEvent::ShortcutOverride)
{
+ // ignore QEvent::ShortcutOverride events originating from outside the application,
+ // since such an extra event is sent e.g. with Orca screen reader enabled,
+ // so that two events of that kind (the "real one" and one from outside)
+ // would otherwise be processed, resulting in duplicate input as 'handleKeyEvent'
+ // is called below (s. tdf#122053)
+ if (pEvent->spontaneous())
+ {
+ return false;
+ }
+
// Accepted event disables shortcut activation,
// but enables keypress event.
// If event is not accepted and shortcut is successfully activated,