diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2020-02-17 10:38:15 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2020-02-17 12:40:46 +0100 |
commit | 034f56015c1c7a61faede33fb5306f63b5585632 (patch) | |
tree | 63831a076962cc3f554911f64cea1baff9eea50e | |
parent | e05c7017a04a1c2a2ee4dc22ee53ae8d66847c32 (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>
-rw-r--r-- | vcl/qt5/Qt5Widget.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx index 5073dbff1a82..0bca51ea55c8 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -450,6 +450,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, |