From 6be238e622471a1a64a7fab3b8779e03b9e07f15 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 12 Jun 2024 14:32:06 +0300 Subject: [PATCH] Fix registering touch screen edge actions after the screen edge has been reserved After the screen edge is reserved, the touch screen gestures will be registered or unregistered when the Edge::activatesForTouchGesture() signal is emitted. On the other hand, Edge::reserveTouch() lacks code to emit that signal, which results in touch screen gesture not working if the same screen edge is reserved both for pointer and touch input. BUG: 451349 --- src/screenedge.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/screenedge.cpp b/src/screenedge.cpp index 141d26351e..de9f55dcb6 100644 --- a/src/screenedge.cpp +++ b/src/screenedge.cpp @@ -188,10 +188,14 @@ void Edge::reserveTouchCallBack(const TouchCallback &callback) })) { return; } + const bool wasTouch = activatesForTouchGesture(); connect(callback.touchUpAction(), &QAction::destroyed, this, [this, callback]() { unreserveTouchCallBack(callback.touchUpAction()); }); m_touchCallbacks << callback; + if (wasTouch != activatesForTouchGesture()) { + Q_EMIT activatesForTouchGestureChanged(); + } reserve(); } @@ -200,10 +204,16 @@ void Edge::unreserveTouchCallBack(QAction *action) auto it = std::find_if(m_touchCallbacks.begin(), m_touchCallbacks.end(), [action](const TouchCallback &c) { return c.touchUpAction() == action; }); - if (it != m_touchCallbacks.end()) { - m_touchCallbacks.erase(it); - unreserve(); + if (it == m_touchCallbacks.end()) { + return; } + + const bool wasTouch = activatesForTouchGesture(); + m_touchCallbacks.erase(it); + if (wasTouch != activatesForTouchGesture()) { + Q_EMIT activatesForTouchGestureChanged(); + } + unreserve(); } void Edge::unreserve()