Changeset 63041 in vbox for trunk/src/VBox
- Timestamp:
- Aug 5, 2016 12:45:19 PM (8 years ago)
- 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 126 126 } 127 127 128 int UIDesktopWidgetWatchdog::screenNumber(const QWidget *pWidget) const 129 { 130 /* Redirect call to QDesktopWidget: */ 131 return QApplication::desktop()->screenNumber(pWidget); 132 } 133 134 int UIDesktopWidgetWatchdog::screenNumber(const QPoint &point) const 135 { 136 /* Redirect call to QDesktopWidget: */ 137 return QApplication::desktop()->screenNumber(point); 138 } 139 128 140 const QRect UIDesktopWidgetWatchdog::screenGeometry(int iHostScreenIndex /* = -1 */) const 129 141 { … … 137 149 } 138 150 151 const QRect UIDesktopWidgetWatchdog::screenGeometry(const QWidget *pWidget) const 152 { 153 /* Redirect call to wrapper above: */ 154 return screenGeometry(screenNumber(pWidget)); 155 } 156 157 const QRect UIDesktopWidgetWatchdog::screenGeometry(const QPoint &point) const 158 { 159 /* Redirect call to wrapper above: */ 160 return screenGeometry(screenNumber(point)); 161 } 162 139 163 const QRect UIDesktopWidgetWatchdog::availableGeometry(int iHostScreenIndex /* = -1 */) const 140 164 { … … 143 167 iHostScreenIndex = QApplication::desktop()->primaryScreen(); 144 168 AssertReturn(iHostScreenIndex >= 0 && iHostScreenIndex < screenCount(), QRect()); 145 146 Q_UNUSED(iHostScreenIndex);147 169 148 170 #ifdef VBOX_WS_X11 … … 154 176 #endif /* !VBOX_WS_X11 */ 155 177 } 178 179 const QRect UIDesktopWidgetWatchdog::availableGeometry(const QWidget *pWidget) const 180 { 181 /* Redirect call to wrapper above: */ 182 return availableGeometry(screenNumber(pWidget)); 183 } 184 185 const 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 192 bool 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 */ 156 204 157 205 void UIDesktopWidgetWatchdog::sltHandleHostScreenCountChanged(int cHostScreenCount) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h
r63040 r63041 56 56 ~UIDesktopWidgetWatchdog(); 57 57 58 /** Returns the host-screen count. */58 /** Returns the number of host-screens currently available on the system. */ 59 59 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; 60 65 61 66 /** Returns the geometry of the host-screen with @a iHostScreenIndex. 62 67 * @note The default screen is used if @a iHostScreenIndex is -1. */ 63 68 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 64 74 /** Returns the available-geometry of the host-screen with @a iHostScreenIndex. 65 75 * @note The default screen is used if @a iHostScreenIndex is -1. */ 66 76 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 */ 67 86 68 87 private slots:
Note:
See TracChangeset
for help on using the changeset viewer.