VirtualBox

Changeset 46225 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
May 22, 2013 7:32:28 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
85954
Message:

FE/Qt: Runtime UI: Seamless-mode: Multi-screen support: Make sure seamless-region correctly propagated for non-primary screens while GUI using QImage frame-buffer.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless
Files:
3 edited

Legend:

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

    r44952 r46225  
    8484        case SetRegionEventType:
    8585        {
    86             /* Get region-update event: */
     86            /* Apply new seamless-region: */
    8787            UISetRegionEvent *pSetRegionEvent = static_cast<UISetRegionEvent*>(pEvent);
    88 
    89             /* Apply new region: */
    90             if (pSetRegionEvent->region() != m_lastVisibleRegion)
    91             {
    92                 m_lastVisibleRegion = pSetRegionEvent->region();
    93                 machineWindow()->setMask(m_lastVisibleRegion);
    94             }
     88            m_lastVisibleRegion = pSetRegionEvent->region();
     89            machineWindow()->setMask(m_lastVisibleRegion);
    9590            return true;
    9691        }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp

    r46224 r46225  
    9797    /* This might be required to correctly mask: */
    9898    centralWidget()->setAutoFillBackground(false);
    99 
    100 #ifdef Q_WS_WIN
    101     /* Get corresponding screen: */
    102     int iScreen = qobject_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);
    103     /* Prepare previous region: */
    104     m_prevRegion = vboxGlobal().availableGeometry(iScreen);
    105 #endif /* Q_WS_WIN */
    10699
    107100#ifdef Q_WS_MAC
     
    280273#endif /* Q_WS_MAC */
    281274
    282 void UIMachineWindowSeamless::setMask(const QRegion &constRegion)
    283 {
    284     /* Could be unused under Mac: */
    285     Q_UNUSED(constRegion);
    286 
    287 #ifndef Q_WS_MAC
    288     /* Copy mask: */
    289     QRegion region = constRegion;
    290 
     275void UIMachineWindowSeamless::setMask(const QRegion &incomingRegion)
     276{
     277    /* Copy region: */
     278    QRegion region(incomingRegion);
     279
     280#ifndef Q_WS_MAC
    291281    /* Shift region if left spacer width is NOT zero or top spacer height is NOT zero: */
    292282    if (m_pLeftSpacer->geometry().width() || m_pTopSpacer->geometry().height())
     
    304294#endif /* !Q_WS_MAC */
    305295
    306 #if defined (Q_WS_WIN)
    307 # if 0 /* This code is disabled for a long time already, need analisys... */
    308     QRegion difference = m_prevRegion.subtract(region);
    309 
    310     /* Region offset calculation */
    311     int fleft = 0, ftop = 0;
    312 
    313     /* Visible region calculation */
    314     HRGN newReg = CreateRectRgn(0, 0, 0, 0);
    315     CombineRgn(newReg, region.handle(), 0, RGN_COPY);
    316     OffsetRgn(newReg, fleft, ftop);
    317 
    318     /* Invisible region calculation */
    319     HRGN diffReg = CreateRectRgn(0, 0, 0, 0);
    320     CombineRgn(diffReg, difference.handle(), 0, RGN_COPY);
    321     OffsetRgn(diffReg, fleft, ftop);
    322 
    323     /* Set the current visible region and clean the previous */
    324     SetWindowRgn(winId(), newReg, FALSE);
    325     RedrawWindow(0, 0, diffReg, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
    326     if (machineView())
    327         RedrawWindow(machineView()->viewport()->winId(), 0, 0, RDW_INVALIDATE);
    328 
    329     m_prevRegion = region;
    330 # endif /* This code is disabled for a long time already, need analisys... */
    331     UIMachineWindow::setMask(region);
    332 #elif defined (Q_WS_MAC)
    333 # ifdef VBOX_GUI_USE_QUARTZ2D
     296#ifdef VBOX_GUI_USE_QUARTZ2D
    334297    if (vboxGlobal().vmRenderMode() == Quartz2DMode)
    335298    {
     
    338301        ::darwinWindowInvalidateShape(m_pMachineView->viewport());
    339302    }
    340 # else /* VBOX_GUI_USE_QUARTZ2D */
    341     UIMachineWindow::setMask(constRegion);
    342 # endif /* !VBOX_GUI_USE_QUARTZ2D */
    343 #else /* !Q_WS_MAC */
    344     UIMachineWindow::setMask(region);
    345 #endif
    346 }
    347 
     303#else /* VBOX_GUI_USE_QUARTZ2D */
     304    /* Seamless-window for empty region should be empty too,
     305     * but native API wrapped by the QWidget::setMask() doesn't allow this.
     306     * Instead, we have a full painted screen of seamless-geometry size visible.
     307     * Moreover, we can't just hide the empty seamless-window as 'hiding'
     308     * 1. will collide with the multi-screen layout behavior and
     309     * 2. will cause a task-bar flicker on moving window from one screen to another.
     310     * As a temporary though quite a dirty workaround we have to make sure
     311     * region have at least one pixel. */
     312    if (region.isEmpty())
     313        region += QRect(0, 0, 1, 1);
     314    /* Make sure region had changed: */
     315    if (m_previousRegion != region)
     316    {
     317        /* Remember new region: */
     318        m_previousRegion = region;
     319        /* Assign new region: */
     320        UIMachineWindow::setMask(m_previousRegion);
     321        /* Update viewport contents: */
     322        m_pMachineView->viewport()->update();
     323    }
     324#endif /* !VBOX_GUI_USE_QUARTZ2D */
     325}
     326
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h

    r46224 r46225  
    9696
    9797    /* Variables: */
    98 #ifdef Q_WS_WIN
    99     QRegion m_prevRegion;
    100 #endif /* Q_WS_WIN */
     98    QRegion m_previousRegion;
    10199
    102100    /* Factory support: */
Note: See TracChangeset for help on using the changeset viewer.

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