Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-56479

Remove spontaneous move event from QGuiApplicationPrivate::processMouseEvent

    XMLWordPrintable

Details

    Description

      QGuiApplicationPrivate::processMouseEvent() sends a move event before a press or release, if the pos has changed since the last move. This causes issues if the move handler spins up a new event loop (e.g. DnD), as we will get a sequence of P, M, P, M, R, R, with PMR interleaved.

      or, if the extra mouse move is inserted into the QPA queue, and the move handler spins up a new event loop, the release is delivered before the move handler is done, opening up for crashes due to using data that was released in the release handler.

      See also: https://gist.github.com/torarnv/7bc8b7e981e96f6a7164365319e41d5b

      QWidget::mouseMoveEvent (http://doc.qt.io/qt-5/qwidget.html#mouseMoveEvent) explicitly documents that:

      QMouseEvent::pos() reports the position of the mouse cursor, relative to this widget. For press and release events, the position is usually the same as the position of the last mouse move event, but it might be different if the user's hand shakes. This is a feature of the underlying window system, not Qt.

      So we should just remove the extra move event and deliver the position update as part of the press/release.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              vestbo Tor Arne Vestbø
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes