From e00d83670847c19c7f92e13b2bb1ef18ae093964 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 3 Mar 2022 09:54:18 +0000 Subject: [PATCH] Force cancel of any drag in progress when Escape is pressed when escape is pressed when dragging between different clients, cancelling any drag is compositor's responsibility BUG:405267 --- src/input.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/input.cpp b/src/input.cpp index 0d86f2a843..650fd3ab69 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -2240,6 +2240,22 @@ public: } return true; } + bool keyEvent(QKeyEvent *event) + { + if (event->key() != Qt::Key_Escape) { + return false; + } + + auto seat = waylandServer()->seat(); + if (!seat->isDrag()) { + return false; + } + seat->setTimestamp(event->timestamp()); + + seat->cancelDrag(); + + return true; + } private: void raiseDragTarget() {