VirtualBox

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


Ignore:
Timestamp:
Jul 21, 2015 5:52:18 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: 5978: Runtime UI: Mini-toolbar: Simplify window activation stealing handling.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
6 edited

Legend:

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

    r57048 r57050  
    123123}
    124124
    125 void UIMachineWindowFullscreen::sltRevokeFocus()
     125void UIMachineWindowFullscreen::sltRevokeWindowActivation()
    126126{
    127127    /* Make sure window is visible: */
     
    129129        return;
    130130
    131 # if   defined(Q_WS_WIN)
    132     /* Revoke stolen focus: */
    133     m_pMachineView->setFocus();
    134 # elif defined(Q_WS_X11)
    135131    /* Revoke stolen activation: */
    136132    activateWindow();
    137 # endif /* Q_WS_X11 */
    138133}
    139134#endif /* Q_WS_WIN || Q_WS_X11 */
     
    257252        connect(m_pMiniToolBar, SIGNAL(sigCloseAction()),
    258253                actionPool()->action(UIActionIndex_M_Application_S_Close), SLOT(trigger()));
    259         connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutFocusStolen()),
    260                 this, SLOT(sltRevokeFocus()), Qt::QueuedConnection);
     254        connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutWindowActivationStolen()),
     255                this, SLOT(sltRevokeWindowActivation()), Qt::QueuedConnection);
    261256    }
    262257}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h

    r57047 r57050  
    6565    void sltMachineStateChanged();
    6666
    67     /** Revokes keyboard-focus. */
    68     void sltRevokeFocus();
     67    /** Revokes window activation. */
     68    void sltRevokeWindowActivation();
    6969#endif /* Q_WS_WIN || Q_WS_X11 */
    7070
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp

    r57048 r57050  
    6464}
    6565
    66 void UIMachineWindowSeamless::sltRevokeFocus()
     66void UIMachineWindowSeamless::sltRevokeWindowActivation()
    6767{
    6868    /* Make sure window is visible: */
     
    7070        return;
    7171
    72 # if   defined(Q_WS_WIN)
    73     /* Revoke stolen focus: */
    74     m_pMachineView->setFocus();
    75 # elif defined(Q_WS_X11)
    7672    /* Revoke stolen activation: */
    7773    activateWindow();
    78 # endif /* Q_WS_X11 */
    7974}
    8075#endif /* Q_WS_WIN || Q_WS_X11 */
     
    139134        connect(m_pMiniToolBar, SIGNAL(sigCloseAction()),
    140135                actionPool()->action(UIActionIndex_M_Application_S_Close), SLOT(trigger()));
    141         connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutFocusStolen()),
    142                 this, SLOT(sltRevokeFocus()), Qt::QueuedConnection);
     136        connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutWindowActivationStolen()),
     137                this, SLOT(sltRevokeWindowActivation()), Qt::QueuedConnection);
    143138    }
    144139}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h

    r57047 r57050  
    4444    void sltMachineStateChanged();
    4545
    46     /** Revokes keyboard-focus. */
    47     void sltRevokeFocus();
     46    /** Revokes window activation. */
     47    void sltRevokeWindowActivation();
    4848#endif /* Q_WS_WIN || Q_WS_X11 */
    4949
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp

    r57047 r57050  
    543543void UIMiniToolBar::prepare()
    544544{
    545 #if defined (Q_WS_X11)
    546545    /* Install own event-filter
    547      * to handle focus stealing: */
     546     * to handle window activation stealing: */
    548547    installEventFilter(this);
    549 #endif /* Q_WS_X11 */
    550548
    551549#if   defined(Q_WS_WIN)
     
    605603        /* Make sure we have no focus: */
    606604        m_pEmbeddedToolbar->setFocusPolicy(Qt::NoFocus);
    607 #ifdef Q_WS_WIN
    608         /* Install embedded-toolbar event-filter: */
    609         m_pEmbeddedToolbar->installEventFilter(this);
    610 #endif /* Q_WS_WIN */
    611605    }
    612606
     
    683677bool UIMiniToolBar::eventFilter(QObject *pWatched, QEvent *pEvent)
    684678{
    685 #if   defined(Q_WS_WIN)
    686     /* Due to Qt bug QMdiArea can
    687      * 1. steal focus from current application focus-widget
    688      * 3. and even request focus stealing if QMdiArea hidden yet.
    689      * We have to notify listeners about such facts.. */
    690     if (pWatched && m_pEmbeddedToolbar && pWatched == m_pEmbeddedToolbar &&
    691         pEvent->type() == QEvent::FocusIn)
    692         emit sigNotifyAboutFocusStolen();
    693 #elif defined(Q_WS_X11)
    694     /* Detect if we have window activation stolen. */
    695     if (pWatched == this &&
    696         pEvent->type() == QEvent::WindowActivate)
    697         emit sigNotifyAboutFocusStolen();
    698 #endif /* Q_WS_X11 */
     679    /* Detect if we have window activation stolen: */
     680    if (pWatched == this && pEvent->type() == QEvent::WindowActivate)
     681        emit sigNotifyAboutWindowActivationStolen();
    699682
    700683    /* Call to base-class: */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h

    r57047 r57050  
    6161    void sigHoverLeave();
    6262
    63     /** Notifies listeners about we stole focus. */
    64     void sigNotifyAboutFocusStolen();
     63    /** Notifies listeners about we stole window activation. */
     64    void sigNotifyAboutWindowActivationStolen();
    6565
    6666public:
     
    109109    void sltHoverLeave();
    110110
    111     /** Notifies listeners about we stole focus. */
    112     void sltNotifyAboutFocusStolen() { emit sigNotifyAboutFocusStolen(); }
     111    /** Notifies listeners about we stole window activation. */
     112    void sltNotifyAboutWindowActivationStolen() { emit sigNotifyAboutWindowActivationStolen(); }
    113113
    114114private:
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