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>
This commit is contained in:
parent
88a8deea86
commit
200c6dd896
@ -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))) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user