Changeset 64446 in vbox for trunk/src/VBox
- Timestamp:
- Oct 27, 2016 3:39:05 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
r64442 r64446 299 299 } 300 300 301 void UIDesktopWidgetWatchdog::sltHandleHostScreenResized(int iHostScreenIndex) 302 { 303 // printf("UIDesktopWidgetWatchdog::sltHandleHostScreenResized(%d)\n", iHostScreenIndex); 304 305 # ifdef VBOX_WS_X11 306 /* Update host-screen available-geometry: */ 307 updateHostScreenAvailableGeometry(iHostScreenIndex); 308 # endif /* VBOX_WS_X11 */ 309 310 /* Notify listeners: */ 311 emit sigHostScreenResized(iHostScreenIndex); 312 } 313 314 void UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized(int iHostScreenIndex) 315 { 316 // printf("UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized(%d)\n", iHostScreenIndex); 317 318 # ifdef VBOX_WS_X11 319 /* Update host-screen available-geometry: */ 320 updateHostScreenAvailableGeometry(iHostScreenIndex); 321 # endif /* VBOX_WS_X11 */ 322 323 /* Notify listeners: */ 324 emit sigHostScreenWorkAreaResized(iHostScreenIndex); 325 } 326 301 327 #else /* QT_VERSION >= 0x050000 */ 302 328 303 void UIDesktopWidgetWatchdog::sltHostScreenAdded(QScreen * /* pHostScreen */)329 void UIDesktopWidgetWatchdog::sltHostScreenAdded(QScreen *pHostScreen) 304 330 { 305 331 // printf("UIDesktopWidgetWatchdog::sltHostScreenAdded(%d)\n", screenCount()); 332 333 /* Listen for screen signals: */ 334 connect(pHostScreen, SIGNAL(geometryChanged(const QRect &)), 335 this, SLOT(sltHandleHostScreenResized(const QRect &))); 336 connect(pHostScreen, SIGNAL(availableGeometryChanged(const QRect &)), 337 this, SLOT(sltHandleHostScreenWorkAreaResized(const QRect &))); 306 338 307 339 # ifdef VBOX_WS_X11 … … 314 346 } 315 347 316 void UIDesktopWidgetWatchdog::sltHostScreenRemoved(QScreen * /* pHostScreen */)348 void UIDesktopWidgetWatchdog::sltHostScreenRemoved(QScreen *pHostScreen) 317 349 { 318 350 // printf("UIDesktopWidgetWatchdog::sltHostScreenRemoved(%d)\n", screenCount()); 351 352 /* Forget about screen signals: */ 353 disconnect(pHostScreen, SIGNAL(geometryChanged(const QRect &)), 354 this, SLOT(sltHandleHostScreenResized(const QRect &))); 355 disconnect(pHostScreen, SIGNAL(availableGeometryChanged(const QRect &)), 356 this, SLOT(sltHandleHostScreenWorkAreaResized(const QRect &))); 319 357 320 358 # ifdef VBOX_WS_X11 … … 327 365 } 328 366 329 #endif /* QT_VERSION >= 0x050000 */ 330 331 void UIDesktopWidgetWatchdog::sltHandleHostScreenResized(int iHostScreenIndex) 332 { 367 void UIDesktopWidgetWatchdog::sltHandleHostScreenResized(const QRect &geometry) 368 { 369 /* Get the screen: */ 370 QScreen *pScreen = sender() ? qobject_cast<QScreen*>(sender()) : 0; 371 AssertPtrReturnVoid(pScreen); 372 373 /* Determine screen index: */ 374 const int iHostScreenIndex = qApp->screens().indexOf(pScreen); 375 AssertReturnVoid(iHostScreenIndex != -1); 333 376 // printf("UIDesktopWidgetWatchdog::sltHandleHostScreenResized(%d)\n", iHostScreenIndex); 334 377 335 # ifdef VBOX_WS_X11378 # ifdef VBOX_WS_X11 336 379 /* Update host-screen available-geometry: */ 337 380 updateHostScreenAvailableGeometry(iHostScreenIndex); 338 # endif /* VBOX_WS_X11 */381 # endif /* VBOX_WS_X11 */ 339 382 340 383 /* Notify listeners: */ … … 342 385 } 343 386 344 void UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized(int iHostScreenIndex) 345 { 387 void UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized(const QRect &availableGeometry) 388 { 389 /* Get the screen: */ 390 QScreen *pScreen = sender() ? qobject_cast<QScreen*>(sender()) : 0; 391 AssertPtrReturnVoid(pScreen); 392 393 /* Determine screen index: */ 394 const int iHostScreenIndex = qApp->screens().indexOf(pScreen); 395 AssertReturnVoid(iHostScreenIndex != -1); 346 396 // printf("UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized(%d)\n", iHostScreenIndex); 347 397 348 # ifdef VBOX_WS_X11398 # ifdef VBOX_WS_X11 349 399 /* Update host-screen available-geometry: */ 350 400 updateHostScreenAvailableGeometry(iHostScreenIndex); 351 # endif /* VBOX_WS_X11 */401 # endif /* VBOX_WS_X11 */ 352 402 353 403 /* Notify listeners: */ 354 404 emit sigHostScreenWorkAreaResized(iHostScreenIndex); 355 405 } 406 407 #endif /* QT_VERSION >= 0x050000 */ 356 408 357 409 #ifdef VBOX_WS_X11 … … 381 433 #if QT_VERSION < 0x050000 382 434 connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(sltHandleHostScreenCountChanged(int))); 435 connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(sltHandleHostScreenResized(int))); 436 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(sltHandleHostScreenWorkAreaResized(int))); 383 437 #else /* QT_VERSION >= 0x050000 */ 384 438 connect(qApp, SIGNAL(screenAdded(QScreen *)), this, SLOT(sltHostScreenAdded(QScreen *))); 385 439 connect(qApp, SIGNAL(screenRemoved(QScreen *)), this, SLOT(sltHostScreenRemoved(QScreen *))); 440 foreach (QScreen *pHostScreen, qApp->screens()) 441 { 442 connect(pHostScreen, SIGNAL(geometryChanged(const QRect &)), 443 this, SLOT(sltHandleHostScreenResized(const QRect &))); 444 connect(pHostScreen, SIGNAL(availableGeometryChanged(const QRect &)), 445 this, SLOT(sltHandleHostScreenWorkAreaResized(const QRect &))); 446 } 386 447 #endif /* QT_VERSION >= 0x050000 */ 387 connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(sltHandleHostScreenResized(int)));388 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(sltHandleHostScreenWorkAreaResized(int)));389 448 390 449 #ifdef VBOX_WS_X11 … … 399 458 #if QT_VERSION < 0x050000 400 459 disconnect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(sltHandleHostScreenCountChanged(int))); 460 disconnect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(sltHandleHostScreenResized(int))); 461 disconnect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(sltHandleHostScreenWorkAreaResized(int))); 401 462 #else /* QT_VERSION >= 0x050000 */ 402 463 disconnect(qApp, SIGNAL(screenAdded(QScreen *)), this, SLOT(sltHostScreenAdded(QScreen *))); 403 464 disconnect(qApp, SIGNAL(screenRemoved(QScreen *)), this, SLOT(sltHostScreenRemoved(QScreen *))); 465 foreach (QScreen *pHostScreen, qApp->screens()) 466 { 467 disconnect(pHostScreen, SIGNAL(geometryChanged(const QRect &)), 468 this, SLOT(sltHandleHostScreenResized(const QRect &))); 469 disconnect(pHostScreen, SIGNAL(availableGeometryChanged(const QRect &)), 470 this, SLOT(sltHandleHostScreenWorkAreaResized(const QRect &))); 471 } 404 472 #endif /* QT_VERSION >= 0x050000 */ 405 disconnect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(sltHandleHostScreenResized(int)));406 disconnect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(sltHandleHostScreenWorkAreaResized(int)));407 473 408 474 #ifdef VBOX_WS_X11 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h
r64440 r64446 111 111 /** Handles host-screen count change to @a cHostScreenCount. */ 112 112 void sltHandleHostScreenCountChanged(int cHostScreenCount); 113 /** Handles resize for the host-screen with @a iHostScreenIndex. */ 114 void sltHandleHostScreenResized(int iHostScreenIndex); 115 /** Handles work-area resize for the host-screen with @a iHostScreenIndex. */ 116 void sltHandleHostScreenWorkAreaResized(int iHostScreenIndex); 113 117 #else /* QT_VERSION >= 0x050000 */ 114 118 /** Handles @a pHostScreen adding. */ … … 116 120 /** Handles @a pHostScreen removing. */ 117 121 void sltHostScreenRemoved(QScreen *pHostScreen); 122 /** Handles host-screen resize to passed @a geometry. */ 123 void sltHandleHostScreenResized(const QRect &geometry); 124 /** Handles host-screen work-area resize to passed @a availableGeometry. */ 125 void sltHandleHostScreenWorkAreaResized(const QRect &availableGeometry); 118 126 #endif /* QT_VERSION >= 0x050000 */ 119 120 /** Handles resize for the host-screen with @a iHostScreenIndex. */121 void sltHandleHostScreenResized(int iHostScreenIndex);122 /** Handles work-area resize for the host-screen with @a iHostScreenIndex. */123 void sltHandleHostScreenWorkAreaResized(int iHostScreenIndex);124 127 125 128 #ifdef VBOX_WS_X11
Note:
See TracChangeset
for help on using the changeset viewer.