sliderladder: detect if wrap didn't work

Wayland doesn't let us control the cursor so this code would break
This commit is contained in:
itsmattkc
2023-05-29 18:09:24 -07:00
parent 4d953adc4b
commit 70690c5b54
+10 -1
View File
@@ -210,6 +210,9 @@ void SliderLadder::TimerUpdate()
int right = screen_->geometry().right();
int width = right - left;
if (now_pos <= left || now_pos >= right) {
int orig_now_pos = now_pos;
int orig_wrap = wrap_count_;
if (now_pos <= left) {
wrap_count_--;
now_pos += width;
@@ -217,7 +220,13 @@ void SliderLadder::TimerUpdate()
wrap_count_++;
now_pos -= width;
}
QCursor::setPos(now_pos, QCursor::pos().y());
QPoint p(now_pos, QCursor::pos().y());
QCursor::setPos(p);
if (QCursor::pos() != p) {
wrap_count_ = orig_wrap;
now_pos = orig_now_pos;
}
}
}