mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Removed redundant code from swipe-to-reply for macOS.
This commit is contained in:
parent
7ca4ca21fa
commit
8ac3c2157f
1 changed files with 2 additions and 23 deletions
|
@ -55,8 +55,6 @@ void SetupSwipeHandler(
|
||||||
bool started = false;
|
bool started = false;
|
||||||
bool reached = false;
|
bool reached = false;
|
||||||
bool touch = false;
|
bool touch = false;
|
||||||
bool twoFingerScrollStarted = false;
|
|
||||||
std::optional<UpdateArgs> pendingUpdate;
|
|
||||||
|
|
||||||
rpl::lifetime lifetime;
|
rpl::lifetime lifetime;
|
||||||
};
|
};
|
||||||
|
@ -191,7 +189,7 @@ void SetupSwipeHandler(
|
||||||
const auto t = static_cast<QTouchEvent*>(e.get());
|
const auto t = static_cast<QTouchEvent*>(e.get());
|
||||||
const auto touchscreen = t->device()
|
const auto touchscreen = t->device()
|
||||||
&& (t->device()->type() == base::TouchDevice::TouchScreen);
|
&& (t->device()->type() == base::TouchDevice::TouchScreen);
|
||||||
if (/*!Platform::IsMac() && */!touchscreen) {
|
if (!touchscreen) {
|
||||||
break;
|
break;
|
||||||
} else if (type == QEvent::TouchBegin) {
|
} else if (type == QEvent::TouchBegin) {
|
||||||
// Reset state in case we lost some TouchEnd.
|
// Reset state in case we lost some TouchEnd.
|
||||||
|
@ -220,12 +218,6 @@ void SetupSwipeHandler(
|
||||||
.delta = state->startAt - touches[0].pos(),
|
.delta = state->startAt - touches[0].pos(),
|
||||||
.touch = true,
|
.touch = true,
|
||||||
};
|
};
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
if (!state->twoFingerScrollStarted) {
|
|
||||||
state->pendingUpdate = args;
|
|
||||||
return base::EventFilterResult::Cancel;
|
|
||||||
}
|
|
||||||
#endif // Q_OS_MAC
|
|
||||||
updateWith(args);
|
updateWith(args);
|
||||||
}
|
}
|
||||||
return (touchscreen && state->orientation != Qt::Horizontal)
|
return (touchscreen && state->orientation != Qt::Horizontal)
|
||||||
|
@ -235,20 +227,7 @@ void SetupSwipeHandler(
|
||||||
case QEvent::Wheel: {
|
case QEvent::Wheel: {
|
||||||
const auto w = static_cast<QWheelEvent*>(e.get());
|
const auto w = static_cast<QWheelEvent*>(e.get());
|
||||||
const auto phase = w->phase();
|
const auto phase = w->phase();
|
||||||
#if 0
|
if (phase == Qt::NoScrollPhase) {
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
if (phase == Qt::ScrollBegin) {
|
|
||||||
state->twoFingerScrollStarted = true;
|
|
||||||
if (const auto update = base::take(state->pendingUpdate)) {
|
|
||||||
updateWith((*update));
|
|
||||||
}
|
|
||||||
} else if (phase == Qt::ScrollEnd
|
|
||||||
|| phase == Qt::ScrollMomentum) {
|
|
||||||
state->twoFingerScrollStarted = false;
|
|
||||||
}
|
|
||||||
#endif // Q_OS_MAC
|
|
||||||
#endif
|
|
||||||
if (/*Platform::IsMac() || */phase == Qt::NoScrollPhase) {
|
|
||||||
break;
|
break;
|
||||||
} else if (phase == Qt::ScrollBegin) {
|
} else if (phase == Qt::ScrollBegin) {
|
||||||
// Reset state in case we lost some TouchEnd.
|
// Reset state in case we lost some TouchEnd.
|
||||||
|
|
Loading…
Add table
Reference in a new issue