Multiple pixel delta by 2.5 on Linux

This commit is contained in:
Ilya Fedin 2023-12-31 10:15:05 +04:00 committed by John Preston
parent 8c01f3f0fa
commit 30ec6ea20d

View file

@ -24,6 +24,7 @@ constexpr auto kOverscrollReturnDuration = crl::time(250);
constexpr auto kOverscrollFromThreshold = -(1 << 30); constexpr auto kOverscrollFromThreshold = -(1 << 30);
constexpr auto kOverscrollTillThreshold = (1 << 30); constexpr auto kOverscrollTillThreshold = (1 << 30);
constexpr auto kTouchOverscrollMultiplier = 2; constexpr auto kTouchOverscrollMultiplier = 2;
constexpr auto kMagicScrollMultiplier = Platform::IsLinux() ? 2.5 : 1.;
constexpr auto kLogA = 16.; constexpr auto kLogA = 16.;
constexpr auto kLogB = 10.; constexpr auto kLogB = 10.;
@ -658,7 +659,7 @@ bool ElasticScroll::handleWheelEvent(not_null<QWheelEvent*> e, bool touch) {
const auto guard = gsl::finally([&] { const auto guard = gsl::finally([&] {
_lastScroll = now; _lastScroll = now;
}); });
const auto pixels = ScrollDelta(e); const auto pixels = ScrollDelta(e) / (touch ? kMagicScrollMultiplier : 1.);
auto delta = _vertical ? -pixels.y() : pixels.x(); auto delta = _vertical ? -pixels.y() : pixels.x();
if (std::abs(_vertical ? pixels.x() : pixels.y()) >= std::abs(delta)) { if (std::abs(_vertical ? pixels.x() : pixels.y()) >= std::abs(delta)) {
delta = 0; delta = 0;
@ -1274,7 +1275,7 @@ QPoint ScrollDelta(not_null<QWheelEvent*> e) {
const auto convert = [](QPoint point) { const auto convert = [](QPoint point) {
return QPoint( return QPoint(
style::ConvertScale(point.x()), style::ConvertScale(point.x()),
style::ConvertScale(point.y())); style::ConvertScale(point.y())) * kMagicScrollMultiplier;
}; };
if (Platform::IsMac() if (Platform::IsMac()
|| (Platform::IsWindows() && e->phase() != Qt::NoScrollPhase)) { || (Platform::IsWindows() && e->phase() != Qt::NoScrollPhase)) {