plugins/shakecursor: Ensure that cursor is magnificated for at least certain amount of time

If the cursor is magnificated and it's slightly moved so the shake
detector returns std::nullopt, the cursor scale will be set back to 1.0
as soon as possible. This is not ideal. Immediately resetting doesn't
help with locating the cursor.

Also the cursor scale reset delay has been increased to two seconds to
provide more time to see the cursor.
This commit is contained in:
Vlad Zahorodnii 2024-01-18 18:03:15 +00:00
parent f6d9b8a0b4
commit 788c186701

View file

@ -83,12 +83,9 @@ void ShakeCursorEffect::pointerEvent(MouseEvent *event)
.size = m_cursor->geometry().size(),
.magnification = std::max(m_cursorMagnification, 1.0 + ShakeCursorConfig::magnification() * shakeFactor.value()),
});
m_resetCursorScaleTimer.start(1000);
m_resetCursorScaleTimer.start(animationTime(2000));
m_resetCursorScaleAnimation.stop();
} else if (m_cursorMagnification != 1.0) {
if (m_resetCursorScaleAnimation.state() != QVariantAnimation::Running) {
m_resetCursorScaleTimer.start(0);
}
update(Transaction{
.position = m_cursor->pos(),
.hotspot = m_cursor->hotspot(),