VirtualBox

Changeset 55336 in vbox


Ignore:
Timestamp:
Apr 20, 2015 12:06:38 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: Mouse-handler: Get the actual mouse-buttons from the QApplication instead of the invalid going from the mouse-events.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp

    r54076 r55336  
    561561                    QPoint p = QPoint(pDeltaEvent->xDelta() + m_lastMousePos.x(),
    562562                                      pDeltaEvent->yDelta() + m_lastMousePos.y());
    563                     if (mouseEvent(pDeltaEvent->mouseEventType(), uScreenId,
    564                                    m_viewports[uScreenId]->mapFromGlobal(p), p,
    565                                    pDeltaEvent->buttons(),
    566                                    pDeltaEvent->wheelDelta(), pDeltaEvent->orientation()))
     563                    /* Old Qt versions had a bug where mouse-buttons coming with the event were not quite valid.
     564                     * For now we will be asking the QApplication for the valid button combination instead. */
     565                    if (mouseEvent(pDeltaEvent->mouseEventType(), uScreenId, m_viewports[uScreenId]->mapFromGlobal(p), p,
     566                                   QApplication::mouseButtons(), pDeltaEvent->wheelDelta(), pDeltaEvent->orientation()))
    567567                        return true;
    568568                    break;
     
    639639                    QMouseEvent *pMouseEvent = static_cast<QMouseEvent*>(pEvent);
    640640                    m_iLastMouseWheelDelta = 0;
    641                     if (mouseEvent(pMouseEvent->type(), uScreenId,
    642                                    pMouseEvent->pos(), pMouseEvent->globalPos(),
    643                                    pMouseEvent->buttons(), 0, Qt::Horizontal))
     641                    /* Old Qt versions had a bug where mouse-buttons coming with the event were not quite valid.
     642                     * For now we will be asking the QApplication for the valid button combination instead. */
     643                    if (mouseEvent(pMouseEvent->type(), uScreenId, pMouseEvent->pos(), pMouseEvent->globalPos(),
     644                                   QApplication::mouseButtons(), 0, Qt::Horizontal))
    644645                        return true;
    645646                    break;
     
    667668                        m_iLastMouseWheelDelta = m_iLastMouseWheelDelta % 120;
    668669                    }
    669                     if (mouseEvent(pWheelEvent->type(), uScreenId,
    670                                    pWheelEvent->pos(), pWheelEvent->globalPos(),
    671 #ifdef QT_MAC_USE_COCOA
    672                                    /* Qt Cocoa is buggy. It always reports a left button pressed when the
    673                                     * mouse wheel event occurs. A workaround is to ask the application which
    674                                     * buttons are pressed currently: */
    675                                    QApplication::mouseButtons(),
    676 #else /* QT_MAC_USE_COCOA */
    677                                    pWheelEvent->buttons(),
    678 #endif /* !QT_MAC_USE_COCOA */
    679                                    iDelta, pWheelEvent->orientation()))
     670                    /* Old Qt versions had a bug where mouse-buttons coming with the event were not quite valid.
     671                     * For now we will be asking the QApplication for the valid button combination instead. */
     672                    if (mouseEvent(pWheelEvent->type(), uScreenId, pWheelEvent->pos(), pWheelEvent->globalPos(),
     673                                   QApplication::mouseButtons(), iDelta, pWheelEvent->orientation()))
    680674                        return true;
    681675                    break;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette