From dd100fb7096efe2a9b4923d3767da95dc4bc1471 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 4 Sep 2024 09:59:05 +0300 Subject: [PATCH] Fixed back gesture responsiveness for swipe-to-reply on macOS. --- Telegram/SourceFiles/history/history_view_swipe.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/history_view_swipe.cpp b/Telegram/SourceFiles/history/history_view_swipe.cpp index 81769891a..9d76075c6 100644 --- a/Telegram/SourceFiles/history/history_view_swipe.cpp +++ b/Telegram/SourceFiles/history/history_view_swipe.cpp @@ -48,7 +48,8 @@ void SetupSwipeHandler( update({ .ratio = std::clamp(ratio, 0., 1.5), .reachRatio = state->animationReach.value(0.), - .translation = int(base::SafeRound(-std::clamp(ratio, 0., 1.5) * threshold)), + .translation = int( + base::SafeRound(-std::clamp(ratio, 0., 1.5) * threshold)), .msgBareId = state->finishByTopData.msgBareId, .cursorTop = state->cursorTop, }); @@ -171,7 +172,9 @@ void SetupSwipeHandler( }; const auto cancel = released(0) || released(1) - || (touches.size() != (touchscreen ? 1 : 2)) + || (touchscreen + ? (touches.size() != 1) + : (touches.size() <= 0 || touches.size() > 2)) || (type == QEvent::TouchEnd) || (type == QEvent::TouchCancel); if (cancel) { @@ -185,6 +188,7 @@ void SetupSwipeHandler( .touch = true, }); } + return base::EventFilterResult::Cancel; } break; case QEvent::Wheel: { const auto w = static_cast(e.get());