From 2ff65af6ab3ebfd662ec2b45bb28b65b4b4e0e4b Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 22 Aug 2019 14:23:33 -0400 Subject: [PATCH] Prevent alt+letter from writting text in fields --- src/qml/Base/HScrollableTextArea.qml | 5 +++++ src/qml/Base/HTextField.qml | 6 ++++++ src/qml/Chat/SendBox.qml | 7 ------- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/qml/Base/HScrollableTextArea.qml b/src/qml/Base/HScrollableTextArea.qml index 47ed1bf7..a026264a 100644 --- a/src/qml/Base/HScrollableTextArea.qml +++ b/src/qml/Base/HScrollableTextArea.qml @@ -27,6 +27,11 @@ ScrollView { color: theme.controls.textArea.background } + Keys.onPressed: if ( + event.modifiers & Qt.AltModifier || + event.modifiers & Qt.MetaModifier + ) event.accepted = true + Keys.forwardTo: mainUI.shortcuts } } diff --git a/src/qml/Base/HTextField.qml b/src/qml/Base/HTextField.qml index dddeab10..7c4dfed9 100644 --- a/src/qml/Base/HTextField.qml +++ b/src/qml/Base/HTextField.qml @@ -28,5 +28,11 @@ TextField { } selectByMouse: true + + Keys.onPressed: if ( + event.modifiers & Qt.AltModifier || + event.modifiers & Qt.MetaModifier + ) event.accepted = true + Keys.forwardTo: mainUI.shortcuts } diff --git a/src/qml/Chat/SendBox.qml b/src/qml/Chat/SendBox.qml index f65957cc..1df37af7 100644 --- a/src/qml/Chat/SendBox.qml +++ b/src/qml/Chat/SendBox.qml @@ -169,13 +169,6 @@ HRectangle { }) area.Keys.onPressed.connect(event => { - if (event.modifiers == Qt.MetaModifier) { - // Prevent super+key from sending the key as text - // on xwayland - event.accepted = true - return - } - if (event.modifiers == Qt.NoModifier && event.key == Qt.Key_Backspace && ! textArea.selectedText)