VirtualBox

Ignore:
Timestamp:
Sep 26, 2014 2:31:02 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
96292
Message:

FE/Qt: X11: Runtime UI: Seamless mode: Include mini-toolbar geometry into seamless-mask.

File:
1 edited

Legend:

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

    r52819 r52870  
    7474    m_pMachineView->setFocus();
    7575}
     76
     77#ifdef VBOX_WITH_MASKED_SEAMLESS
     78# ifdef Q_WS_X11
     79void UIMachineWindowSeamless::sltUpdateMiniToolbarMask(const QRect &geo)
     80{
     81    /* Make sure mini-toolbar exists: */
     82    AssertPtrReturnVoid(m_pMiniToolBar);
     83
     84    /* Remember mini-toolbar mask: */
     85    m_maskMiniToolbar = geo;
     86
     87    /* Re-assign guest mask. */
     88    setMask(m_maskGuest);
     89}
     90# endif /* Q_WS_X11 */
     91#endif /* VBOX_WITH_MASKED_SEAMLESS */
    7692
    7793void UIMachineWindowSeamless::prepareVisualState()
     
    103119    /* Make sure we have no background
    104120     * until the first one set-region-event: */
    105     setMask(m_maskRegion);
     121    setMask(m_maskGuest);
    106122#endif /* VBOX_WITH_MASKED_SEAMLESS */
    107123
     
    132148            actionPool()->action(UIActionIndexRT_M_Machine_S_Close), SLOT(trigger()));
    133149    connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutFocusStolen()), this, SLOT(sltRevokeFocus()));
     150#ifdef VBOX_WITH_MASKED_SEAMLESS
     151# ifdef Q_WS_X11
     152    connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutGeometryChange(const QRect&)),
     153            this, SLOT(sltUpdateMiniToolbarMask(const QRect&)));
     154# endif /* Q_WS_X11 */
     155#endif /* VBOX_WITH_MASKED_SEAMLESS */
    134156}
    135157#endif /* !Q_WS_MAC */
     
    280302
    281303#ifdef VBOX_WITH_MASKED_SEAMLESS
    282 void UIMachineWindowSeamless::setMask(const QRegion &region)
    283 {
    284     /* Prepare mask-region: */
    285     QRegion maskRegion(region);
    286 
    287     /* Shift region if left spacer width is NOT zero or top spacer height is NOT zero: */
     304void UIMachineWindowSeamless::setMask(const QRegion &maskGuest)
     305{
     306    /* Remember new guest mask: */
     307    m_maskGuest = maskGuest;
     308
     309    /* Prepare full mask: */
     310    QRegion maskFull(m_maskGuest);
     311
     312    /* Shift full mask if left or top spacer width is NOT zero: */
    288313    if (m_pLeftSpacer->geometry().width() || m_pTopSpacer->geometry().height())
    289         maskRegion.translate(m_pLeftSpacer->geometry().width(), m_pTopSpacer->geometry().height());
    290 
    291     /* Seamless-window for empty region should be empty too,
     314        maskFull.translate(m_pLeftSpacer->geometry().width(), m_pTopSpacer->geometry().height());
     315
     316# ifdef Q_WS_X11
     317    /* Take into account mini-toolbar mask if necessary: */
     318    if (m_pMiniToolBar)
     319        maskFull += m_maskMiniToolbar;
     320# endif /* Q_WS_X11 */
     321
     322    /* Seamless-window for empty full mask should be empty too,
    292323     * but the QWidget::setMask() wrapper doesn't allow this.
    293      * Instead, we have a full painted screen of seamless-geometry size visible.
    294      * Moreover, we can't just hide the empty seamless-window as 'hiding'
    295      * 1. will collide with the multi-screen layout behavior and
    296      * 2. will cause a task-bar flicker on moving window from one screen to another.
    297      * As a *temporary* though quite a dirty workaround we have to make sure
    298      * region have at least one pixel. */
    299     if (maskRegion.isEmpty())
    300         maskRegion += QRect(0, 0, 1, 1);
    301     /* Make sure mask-region had changed: */
    302     if (m_maskRegion != maskRegion)
     324     * Instead, we see a full guest-screen of available-geometry size.
     325     * So we have to make sure full mask have at least one pixel. */
     326    if (maskFull.isEmpty())
     327        maskFull += QRect(0, 0, 1, 1);
     328
     329    /* Make sure full mask had changed: */
     330    if (m_maskFull != maskFull)
    303331    {
    304332        /* Compose viewport region to update: */
    305         QRegion toUpdate = m_maskRegion + maskRegion;
    306         /* Remember new mask-region: */
    307         m_maskRegion = maskRegion;
    308         /* Assign new mask-region: */
    309         UIMachineWindow::setMask(m_maskRegion);
     333        QRegion toUpdate = m_maskFull + maskFull;
     334        /* Remember new full mask: */
     335        m_maskFull = maskFull;
     336        /* Assign new full mask: */
     337        UIMachineWindow::setMask(m_maskFull);
    310338        /* Update viewport region finally: */
    311339        m_pMachineView->viewport()->update(toUpdate);
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