[vlc-commits] qml: fix Escape key event being handled twice in player menu
Pierre Lamot
git at videolan.org
Tue Nov 19 16:49:56 CET 2019
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Wed Oct 16 16:52:44 2019 +0200| [9b1e369298bc92ebce94a4b5782892a3b22aa925] | committer: Jean-Baptiste Kempf
qml: fix Escape key event being handled twice in player menu
popup item was grabbin Escape key before the application (as a shortcut)
then the Escape key was interpreted by the player itself
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9b1e369298bc92ebce94a4b5782892a3b22aa925
---
modules/gui/qt/qml/player/PlayerMenu.qml | 3 +++
modules/gui/qt/qml/player/PlayerMenuItem.qml | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/modules/gui/qt/qml/player/PlayerMenu.qml b/modules/gui/qt/qml/player/PlayerMenu.qml
index 66fb88d6f2..8dc1c680d4 100644
--- a/modules/gui/qt/qml/player/PlayerMenu.qml
+++ b/modules/gui/qt/qml/player/PlayerMenu.qml
@@ -39,6 +39,9 @@ T.Menu {
modal: true
cascade: false
+ //don't CloseOnEscape, otherwise the event is processed before our key handlers
+ closePolicy: Popup.CloseOnPressOutside
+
x:0
y:0
width: parent.width / 4
diff --git a/modules/gui/qt/qml/player/PlayerMenuItem.qml b/modules/gui/qt/qml/player/PlayerMenuItem.qml
index 4f6b6a0cac..96c0ceed18 100644
--- a/modules/gui/qt/qml/player/PlayerMenuItem.qml
+++ b/modules/gui/qt/qml/player/PlayerMenuItem.qml
@@ -124,6 +124,13 @@ T.MenuItem {
event.accepted = false
}
+ Keys.onReleased: {
+ if (KeyHelper.matchCancel(event)) {
+ event.accepted = true
+ parentMenu.dismiss()
+ }
+ }
+
onTriggered: {
if (parentMenu && subMenu) {
parentMenu._emitMenuClose = false
More information about the vlc-commits
mailing list