]> git.lyx.org Git - features.git/commitdiff
Workaround Qtbug where QAbstractScrollArea::mouseMoveEvent(...)
authorEugene Chornyi <yu_jin@lyx.org>
Thu, 9 Jul 2020 07:36:12 +0000 (09:36 +0200)
committerEugene Chornyi <yu_jin@lyx.org>
Thu, 10 Sep 2020 19:43:37 +0000 (21:43 +0200)
is called falsely when quickly double tapping on a touchpad of a notebook running Windows (only for specific Qt Versions)

src/frontends/qt4/GuiWorkArea.cpp
status.23x

index 95cff6d5ec30f8c7d8de4903e3750115022cff16..046199d87e303a1f8ab8337d249cc0477e715526 100644 (file)
@@ -858,6 +858,10 @@ void GuiWorkArea::mouseReleaseEvent(QMouseEvent * e)
 
        FuncRequest const cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(),
                        q_button_state(e->button()), q_key_state(e->modifiers()));
+#if (QT_VERSION > QT_VERSION_CHECK(5,10,1) && \
+       QT_VERSION < QT_VERSION_CHECK(5,15,1))
+       d->synthetic_mouse_event_.cmd = cmd; // QtBug QAbstractScrollArea::mouseMoveEvent
+#endif
        d->dispatch(cmd);
        e->accept();
 }
@@ -865,6 +869,21 @@ void GuiWorkArea::mouseReleaseEvent(QMouseEvent * e)
 
 void GuiWorkArea::mouseMoveEvent(QMouseEvent * e)
 {
+#if (QT_VERSION > QT_VERSION_CHECK(5,10,1) && \
+       QT_VERSION < QT_VERSION_CHECK(5,15,1))
+       // cancel the event if the coordinates didn't change, this is due to QtBug
+       // QAbstractScrollArea::mouseMoveEvent, the event is triggered falsely when quickly
+       // double tapping a touchpad. To test: try to select a word by quickly double tapping
+       // on a touchpad while hovering the cursor over that word in the work area.
+       // This bug does not occur on Qt versions 5.10.1 and below. Only Windows seems to be affected.
+       // ML thread: https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg211699.html
+       // Qt bugtracker: https://bugreports.qt.io/browse/QTBUG-85431
+       // Bug was fixed in Qt 5.15.1
+       if (e->x() == d->synthetic_mouse_event_.cmd.x() && // QtBug QAbstractScrollArea::mouseMoveEvent
+                       e->y() == d->synthetic_mouse_event_.cmd.y()) // QtBug QAbstractScrollArea::mouseMoveEvent
+               return; // QtBug QAbstractScrollArea::mouseMoveEvent
+#endif
+
        // we kill the triple click if we move
        doubleClickTimeout();
        FuncRequest cmd(LFUN_MOUSE_MOTION, e->x(), e->y(),
index 0ae9eff42b00f272e7ff021ed20446ae77db7539..57906bef36e6f93e2430b23ee10322c34f9b7e82 100644 (file)
@@ -91,6 +91,8 @@ What's new
 
 - Fix display bug when typing in a paragraph where row heights change (bug 11601).
 
+- Fix wrong marking-text-behavior with doubleclick on notebook touchpads (Windows)
+
 - Fix spacing of limits of sum-like operators in display style.
 
 - Fix positioning of super- and subscripts with integral signs.