Skip to content

Commit

Permalink
sliderladder: detect if wrap didn't work
Browse files Browse the repository at this point in the history
Wayland doesn't let us control the cursor so this code would break
  • Loading branch information
itsmattkc committed May 30, 2023
1 parent 4d953ad commit 70690c5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/widget/slider/base/sliderladder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,23 @@ 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;
} else {
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;
}
}
}

Expand Down

0 comments on commit 70690c5

Please sign in to comment.