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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user