VirtualBox

Changeset 27993 in vbox


Ignore:
Timestamp:
Apr 6, 2010 9:13:14 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
59700
Message:

FE/Qt: 4655: GUI multi-screen support: allowing to move guest windows between host machine windows in absolute mouse mode.

File:
1 edited

Legend:

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

    r27839 r27993  
    4343#include "UIMachineWindow.h"
    4444#include "UIMachineView.h"
     45#include "UIMachineWindowNormal.h"
     46#include "UIMachineWindowFullscreen.h"
     47#include "UIMachineWindowSeamless.h"
    4548#include "UIMachineViewNormal.h"
    4649#include "UIMachineViewFullscreen.h"
     
    10381041        {
    10391042            case QEvent::MouseMove:
     1043            case QEvent::MouseButtonRelease:
     1044            {
     1045                /* Check if we should propagate this event to another window: */
     1046                QWidget *pWidgetAt = QApplication::widgetAt(QCursor::pos());
     1047                if (pWidgetAt && pWidgetAt->window() && pWidgetAt->window()->inherits("UIMachineWindow") &&
     1048                    pWidgetAt->window() != machineWindowWrapper()->machineWindow())
     1049                {
     1050                    /* Get current mouse-move event: */
     1051                    QMouseEvent *pOldMouseEvent = static_cast<QMouseEvent*>(pEvent);
     1052
     1053                    /* Get real destination window of that event: */
     1054                    UIMachineWindow *pMachineWindow =
     1055                        pWidgetAt->window()->inherits("UIMachineWindowNormal") ?
     1056                        static_cast<UIMachineWindow*>(qobject_cast<UIMachineWindowNormal*>(pWidgetAt->window())) :
     1057                        pWidgetAt->window()->inherits("UIMachineWindowFullscreen") ?
     1058                        static_cast<UIMachineWindow*>(qobject_cast<UIMachineWindowFullscreen*>(pWidgetAt->window())) :
     1059                        pWidgetAt->window()->inherits("UIMachineWindowSeamless") ?
     1060                        static_cast<UIMachineWindow*>(qobject_cast<UIMachineWindowSeamless*>(pWidgetAt->window())) : 0;
     1061                    if (pMachineWindow)
     1062                    {
     1063                        /* Get viewport: */
     1064                        QWidget *pOtherViewport = pMachineWindow->machineView()->viewport();
     1065
     1066                        /* Prepare redirected mouse-move event: */
     1067                        QMouseEvent *pNewMouseEvent = new QMouseEvent(pOldMouseEvent->type(),
     1068                                                                      pOtherViewport->mapFromGlobal(pOldMouseEvent->globalPos()),
     1069                                                                      pOldMouseEvent->globalPos(),
     1070                                                                      pOldMouseEvent->button(),
     1071                                                                      pOldMouseEvent->buttons(),
     1072                                                                      pOldMouseEvent->modifiers());
     1073
     1074                        /* Send that event to real destination: */
     1075                        QApplication::postEvent(pOtherViewport, pNewMouseEvent);
     1076
     1077                        /* Filter out that event: */
     1078                        return true;
     1079                    }
     1080                }
     1081                /* Else this event will be processed using next 'case': */
     1082            }
    10401083            case QEvent::MouseButtonPress:
    10411084            case QEvent::MouseButtonDblClick:
    1042             case QEvent::MouseButtonRelease:
    10431085            {
    10441086                QMouseEvent *pMouseEvent = static_cast<QMouseEvent*>(pEvent);
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