VirtualBox

Ignore:
Timestamp:
Mar 14, 2014 10:32:36 AM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: Mouse handler: More appropriate hovered widget fetching which works even in case of 3D overlay presence.

File:
1 edited

Legend:

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

    r50265 r50784  
    548548                case QEvent::MouseButtonRelease:
    549549                {
     550                    /* Get mouse-event: */
     551                    QMouseEvent *pOldMouseEvent = static_cast<QMouseEvent*>(pEvent);
     552
     553                    /* Check which viewport(s) we *probably* hover: */
     554                    QWidgetList probablyHoveredViewports;
     555                    foreach (QWidget *pViewport, m_viewports)
     556                    {
     557                        QPoint posInViewport = pViewport->mapFromGlobal(pOldMouseEvent->globalPos());
     558                        if (pViewport->geometry().contains(posInViewport))
     559                            probablyHoveredViewports << pViewport;
     560                    }
     561                    /* Determine actually hovered viewport: */
     562                    QWidget *pHoveredWidget = probablyHoveredViewports.isEmpty() ? 0 :
     563                                              probablyHoveredViewports.contains(pWatchedWidget) ? pWatchedWidget :
     564                                              probablyHoveredViewports.first();
     565
    550566                    /* Check if we should propagate this event to another window: */
    551                     QWidget *pHoveredWidget = QApplication::widgetAt(QCursor::pos());
    552567                    if (pHoveredWidget && pHoveredWidget != pWatchedWidget && m_viewports.values().contains(pHoveredWidget))
    553568                    {
    554                         /* Get current mouse-move event: */
    555                         QMouseEvent *pOldMouseEvent = static_cast<QMouseEvent*>(pEvent);
    556 
    557569                        /* Prepare redirected mouse-move event: */
    558570                        QMouseEvent *pNewMouseEvent = new QMouseEvent(pOldMouseEvent->type(),
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