VirtualBox

Changeset 63041 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 5, 2016 12:45:19 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8422: Desktop-widget watchdog rework (part 10): Extend interface with required wrappers to existing methods.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp

    r63040 r63041  
    126126}
    127127
     128int UIDesktopWidgetWatchdog::screenNumber(const QWidget *pWidget) const
     129{
     130    /* Redirect call to QDesktopWidget: */
     131    return QApplication::desktop()->screenNumber(pWidget);
     132}
     133
     134int UIDesktopWidgetWatchdog::screenNumber(const QPoint &point) const
     135{
     136    /* Redirect call to QDesktopWidget: */
     137    return QApplication::desktop()->screenNumber(point);
     138}
     139
    128140const QRect UIDesktopWidgetWatchdog::screenGeometry(int iHostScreenIndex /* = -1 */) const
    129141{
     
    137149}
    138150
     151const QRect UIDesktopWidgetWatchdog::screenGeometry(const QWidget *pWidget) const
     152{
     153    /* Redirect call to wrapper above: */
     154    return screenGeometry(screenNumber(pWidget));
     155}
     156
     157const QRect UIDesktopWidgetWatchdog::screenGeometry(const QPoint &point) const
     158{
     159    /* Redirect call to wrapper above: */
     160    return screenGeometry(screenNumber(point));
     161}
     162
    139163const QRect UIDesktopWidgetWatchdog::availableGeometry(int iHostScreenIndex /* = -1 */) const
    140164{
     
    143167        iHostScreenIndex = QApplication::desktop()->primaryScreen();
    144168    AssertReturn(iHostScreenIndex >= 0 && iHostScreenIndex < screenCount(), QRect());
    145 
    146     Q_UNUSED(iHostScreenIndex);
    147169
    148170#ifdef VBOX_WS_X11
     
    154176#endif /* !VBOX_WS_X11 */
    155177}
     178
     179const QRect UIDesktopWidgetWatchdog::availableGeometry(const QWidget *pWidget) const
     180{
     181    /* Redirect call to wrapper above: */
     182    return availableGeometry(screenNumber(pWidget));
     183}
     184
     185const QRect UIDesktopWidgetWatchdog::availableGeometry(const QPoint &point) const
     186{
     187    /* Redirect call to wrapper above: */
     188    return availableGeometry(screenNumber(point));
     189}
     190
     191#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
     192bool UIDesktopWidgetWatchdog::isFakeScreenDetected() const
     193{
     194    // WORKAROUND:
     195    // In 5.6.1 Qt devs taught the XCB plugin to silently swap last detached screen
     196    // with a fake one, and there is no API-way to distinguish fake from real one
     197    // because all they do is erasing output for the last real screen, keeping
     198    // all other screen attributes stale. Gladly output influencing screen name
     199    // so we can use that horrible workaround to detect a fake XCB screen.
     200    return    qApp->screens().size() == 0 /* zero-screen case is impossible after 5.6.1 */
     201           || (qApp->screens().size() == 1 && qApp->screens().first()->name() == ":0.0");
     202}
     203#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
    156204
    157205void UIDesktopWidgetWatchdog::sltHandleHostScreenCountChanged(int cHostScreenCount)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h

    r63040 r63041  
    5656    ~UIDesktopWidgetWatchdog();
    5757
    58     /** Returns the host-screen count. */
     58    /** Returns the number of host-screens currently available on the system. */
    5959    int screenCount() const;
     60
     61    /** Returns the index of the screen which contains contains @a pWidget. */
     62    int screenNumber(const QWidget *pWidget) const;
     63    /** Returns the index of the screen which contains contains @a point. */
     64    int screenNumber(const QPoint &point) const;
    6065
    6166    /** Returns the geometry of the host-screen with @a iHostScreenIndex.
    6267      * @note The default screen is used if @a iHostScreenIndex is -1. */
    6368    const QRect screenGeometry(int iHostScreenIndex = -1) const;
     69    /** Returns the geometry of the host-screen which contains @a pWidget. */
     70    const QRect screenGeometry(const QWidget *pWidget) const;
     71    /** Returns the geometry of the host-screen which contains @a point. */
     72    const QRect screenGeometry(const QPoint &point) const;
     73
    6474    /** Returns the available-geometry of the host-screen with @a iHostScreenIndex.
    6575      * @note The default screen is used if @a iHostScreenIndex is -1. */
    6676    const QRect availableGeometry(int iHostScreenIndex = -1) const;
     77    /** Returns the available-geometry of the host-screen which contains @a pWidget. */
     78    const QRect availableGeometry(const QWidget *pWidget) const;
     79    /** Returns the available-geometry of the host-screen which contains @a point. */
     80    const QRect availableGeometry(const QPoint &point) const;
     81
     82#if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000
     83    /** Qt5: X11: Returns whether no or fake screen detected. */
     84    bool isFakeScreenDetected() const;
     85#endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */
    6786
    6887private slots:
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