plugins/shakecursor: Don't trigger for cursor pushback
The shake detector is mistriggered by sporadic pointer movement when the cursor is pushed back by a screen edge. As a way to prevent it, this change adds a bounding rectangle constraint. The cursor will move chaotically within a small bounding rectangle if it's pushed back. So it should be enough to just check the length of the diagonal.
This commit is contained in:
parent
999814796b
commit
494e4a07f2
1 changed files with 1 additions and 1 deletions
|
@ -72,7 +72,7 @@ std::optional<qreal> ShakeDetector::update(QMouseEvent *event)
|
|||
const qreal boundsWidth = right - left;
|
||||
const qreal boundsHeight = bottom - top;
|
||||
const qreal diagonal = std::sqrt(boundsWidth * boundsWidth + boundsHeight * boundsHeight);
|
||||
if (diagonal == 0) {
|
||||
if (diagonal < 100) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue