diff options
author | Gatis Paeglis <gatis.paeglis@qt.io> | 2017-10-27 14:19:03 +0200 |
---|---|---|
committer | Gatis Paeglis <gatis.paeglis@qt.io> | 2017-10-27 20:48:33 +0000 |
commit | 200c6dd896c13cf86dbf25842f3839c49cff226d (patch) | |
tree | 6ee542790d88d3f9f86ca95dbf53802b25c6b160 /src/widgets/kernel/qwidgetwindow.cpp | |
parent | 88a8deea86fe69448ca1586c2ee567a53dee1008 (diff) |
qwidgetwindow: remove seemingly stray QApplicationPrivate::mouse_buttons
This patch removes mouse_buttons related code from qwidgetwindow.cpp
as it does not belong there for the following reasons:
- The commit (ed2a2dc6dae0a2523cecfd272609d322ace16145) that added it in
Qt5 says that the logic was copied from qapplication_x11.cpp (filename
in Qt4 repository). Other qapplication_*.cpp platform implementations
did not have this kind of logic; thus having it in cross platform location
qwidgetwindow.cpp does not make sense.
- According to the documentation, QApplicationPrivate::mouse_buttons:
"Returns the current state of the buttons on the mouse. The current state
is updated synchronously as the event queue is emptied".
So the only place where changing this variable makes sense is in
QGuiApplicationPrivate::processMouseEvent, which is *when the event
queue is emptied*.
There are other places in source code where this variable is changed,
but all of those are hacks and should be cleaned out eventually:
// a hack due to insufficient QWindowSystemInterface API
plugins/platforms/windows/qwindowsdrag.cpp
// a hack to support code that bypasses QWSI API when sending mouse events
// via qApp->notify().
widgets/kernel/qapplication.cpp
- AFACT, the released button bit will be already unset by the time mouse
release event reaches QWidgetWindow::handleMouseEvent.
Change-Id: Ifb2b3b443ffff0274545e5d3c631cf1e77160502
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'src/widgets/kernel/qwidgetwindow.cpp')
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 80ed39bf76..2b703e8ff2 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -633,12 +633,9 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) QWidget *receiver = QApplicationPrivate::pickMouseReceiver(m_widget, event->windowPos().toPoint(), &mapped, event->type(), event->buttons(), qt_button_down, widget); - - if (!receiver) { - if (event->type() == QEvent::MouseButtonRelease) - QApplicationPrivate::mouse_buttons &= ~event->button(); + if (!receiver) return; - } + if ((event->type() != QEvent::MouseButtonPress) || !(event->flags().testFlag(Qt::MouseEventCreatedDoubleClick))) { |