Changeset 97704 in vbox for trunk/src/VBox
- Timestamp:
- Nov 29, 2022 12:23:10 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 154761
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp
r97703 r97704 296 296 297 297 /* static */ 298 int UIDesktopWidgetWatchdog::overallDesktopWidth()299 {300 #ifdef VBOX_IS_QT6_OR_LATER301 /** @todo bird: Not sure if this is entirely correct. */302 return QGuiApplication::primaryScreen()->geometry().width();303 #else304 /* Redirect call to desktop-widget: */305 return QApplication::desktop()->width();306 #endif307 }308 309 /* static */310 int UIDesktopWidgetWatchdog::overallDesktopHeight()311 {312 #ifdef VBOX_IS_QT6_OR_LATER313 /** @todo bird: Not sure if this is entirely correct. */314 return QGuiApplication::primaryScreen()->geometry().height();315 #else316 /* Redirect call to desktop-widget: */317 return QApplication::desktop()->height();318 #endif319 }320 321 /* static */322 298 int UIDesktopWidgetWatchdog::screenCount() 323 299 { 324 300 return QGuiApplication::screens().size(); 325 }326 327 /** Helper for generating qt5 screen indexes as best as we can. */328 static int screenToIndex(QScreen *pScreen)329 {330 if (pScreen)331 {332 /** @todo Not at all sure about the sensitibility of this. */333 QList<QScreen *> screenList = QGuiApplication::screens();334 unsigned iScreen = 0;335 foreach (QScreen *pCurScreen, screenList)336 {337 if ( pCurScreen == pScreen338 || ( pCurScreen->geometry() == pScreen->geometry()339 && pCurScreen->serialNumber() == pScreen->serialNumber()))340 return iScreen;341 iScreen++;342 }343 }344 return -1;345 301 } 346 302 … … 524 480 /* Return region: */ 525 481 return region; 482 } 483 484 /* static */ 485 int UIDesktopWidgetWatchdog::overallDesktopWidth() 486 { 487 #ifdef VBOX_IS_QT6_OR_LATER 488 /** @todo bird: Not sure if this is entirely correct. */ 489 return QGuiApplication::primaryScreen()->geometry().width(); 490 #else 491 /* Redirect call to desktop-widget: */ 492 return QApplication::desktop()->width(); 493 #endif 494 } 495 496 /* static */ 497 int UIDesktopWidgetWatchdog::overallDesktopHeight() 498 { 499 #ifdef VBOX_IS_QT6_OR_LATER 500 /** @todo bird: Not sure if this is entirely correct. */ 501 return QGuiApplication::primaryScreen()->geometry().height(); 502 #else 503 /* Redirect call to desktop-widget: */ 504 return QApplication::desktop()->height(); 505 #endif 526 506 } 527 507 … … 1084 1064 1085 1065 /* static */ 1066 int UIDesktopWidgetWatchdog::screenToIndex(QScreen *pScreen) 1067 { 1068 if (pScreen) 1069 { 1070 unsigned iScreen = 0; 1071 foreach (QScreen *pCurScreen, QGuiApplication::screens()) 1072 { 1073 if ( pCurScreen == pScreen 1074 || ( pCurScreen->geometry() == pScreen->geometry() 1075 && pCurScreen->serialNumber() == pScreen->serialNumber())) 1076 return iScreen; 1077 ++iScreen; 1078 } 1079 } 1080 return -1; 1081 } 1082 1083 /* static */ 1086 1084 QRegion UIDesktopWidgetWatchdog::flip(const QRegion ®ion) 1087 1085 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h
r97703 r97704 82 82 /** Destroys the static instance of the desktop-widget watchdog. */ 83 83 static void destroy(); 84 85 /** Returns overall desktop width. */86 static int overallDesktopWidth();87 /** Returns overall desktop height. */88 static int overallDesktopHeight();89 84 90 85 /** Returns the number of host-screens currently available on the system. */ … … 123 118 /** Returns overall region unifying all the host-screen available-geometries. */ 124 119 QRegion overallAvailableRegion() const; 120 /** Returns overall desktop width. */ 121 static int overallDesktopWidth(); 122 /** Returns overall desktop height. */ 123 static int overallDesktopHeight(); 125 124 126 125 #ifdef VBOX_WS_X11 … … 190 189 void cleanup(); 191 190 191 /** Returns index of passed @a pScreen. */ 192 static int screenToIndex(QScreen *pScreen); 193 192 194 /** Returns the flipped (transposed) @a region. */ 193 195 static QRegion flip(const QRegion ®ion);
Note:
See TracChangeset
for help on using the changeset viewer.