From f5744fa224e1a43c4d5972139c26a2c137f37086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 10 Feb 2013 06:56:38 +0100 Subject: [PATCH] catch releases without presses happens when the polling misses the press when doing more important things also shortcut buttons == oldButtons BUG: 314762 FIXED-IN: 4.10.1 REVIEW: 108883 --- effects/mouseclick/mouseclick.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/effects/mouseclick/mouseclick.cpp b/effects/mouseclick/mouseclick.cpp index b661c08379..a9486c07c9 100644 --- a/effects/mouseclick/mouseclick.cpp +++ b/effects/mouseclick/mouseclick.cpp @@ -166,12 +166,16 @@ void MouseClickEffect::slotMouseChanged(const QPoint& pos, const QPoint&, Qt::MouseButtons buttons, Qt::MouseButtons oldButtons, Qt::KeyboardModifiers, Qt::KeyboardModifiers) { + if (buttons == oldButtons) + return; + MouseEvent* m = NULL; for (int i = 0; i < BUTTON_COUNT; ++i) { MouseButton* b = m_buttons[i]; if (isPressed(b->m_button, buttons, oldButtons)) { m = new MouseEvent(i, pos, 0, createEffectFrame(pos, b->m_labelDown), true); - } else if (isReleased(b->m_button, buttons, oldButtons) && b->m_time > m_ringLife) { + } else if (isReleased(b->m_button, buttons, oldButtons) && (!b->m_isPressed || b->m_time > m_ringLife)) { + // we might miss a press, thus also check !b->m_isPressed, bug #314762 m = new MouseEvent(i, pos, 0, createEffectFrame(pos, b->m_labelUp), false); } b->setPressed(b->m_button & buttons);