Changeset 61965 in vbox
- Timestamp:
- Jun 30, 2016 5:20:40 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 108411
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r61964 r61965 363 363 # endif /* QT_VERSION < 0x050000 */ 364 364 365 /* If there is a mini-toolbar: */366 if (m_pMiniToolBar)367 {368 # if QT_VERSION >= 0x050000369 /* Map mini-toolbar onto required screen: */370 m_pMiniToolBar->windowHandle()->setScreen(qApp->screens().at(iHostScreen));371 # endif /* QT_VERSION >= 0x050000 */372 /* Set appropriate mini-toolbar size: */373 m_pMiniToolBar->resize(workingArea.size());374 # if QT_VERSION < 0x050000375 /* Move mini-toolbar onto required screen: */376 m_pMiniToolBar->move(workingArea.topLeft());377 # endif /* QT_VERSION < 0x050000 */378 }379 380 365 #elif defined(VBOX_WS_X11) 381 366 … … 387 372 /* Tell recent window managers which host-screen this window should be mapped to: */ 388 373 VBoxGlobal::setFullScreenMonitorX11(this, pFullscreenLogic->hostScreenForGuestScreen(m_uScreenId)); 389 390 /* If there is a mini-toolbar: */ 391 if (m_pMiniToolBar) 392 { 393 /* Tell recent window managers which host-screen this mini-toolbar should be mapped to: */ 394 VBoxGlobal::setFullScreenMonitorX11(m_pMiniToolBar, pFullscreenLogic->hostScreenForGuestScreen(m_uScreenId)); 395 } 396 } 397 398 /* Set appropriate geometry for window: */ 374 } 375 376 /* Set appropriate window geometry: */ 399 377 resize(workingArea.size()); 400 378 move(workingArea.topLeft()); 401 402 /* If there is a mini-toolbar: */403 if (m_pMiniToolBar)404 {405 /* Set appropriate geometry for mini-toolbar: */406 m_pMiniToolBar->resize(workingArea.size());407 m_pMiniToolBar->move(workingArea.topLeft());408 }409 379 410 380 #else … … 462 432 setWindowState(Qt::WindowNoState); 463 433 hide(); 464 465 /* If there is mini-toolbar: */466 if (m_pMiniToolBar)467 {468 /* Hide mini-toolbar and reset it's state to NONE: */469 m_pMiniToolBar->setWindowState(Qt::WindowNoState);470 m_pMiniToolBar->hide();471 }472 434 } 473 435 /* If window should be shown and mapped to some host-screen: */ … … 480 442 /* Make sure window have appropriate geometry: */ 481 443 placeOnScreen(); 482 483 /* If there is mini-toolbar: */484 if (m_pMiniToolBar)485 {486 /* Show mini-toolbar: */487 m_pMiniToolBar->showFullScreen();488 }489 444 490 445 /* Show window: */ … … 518 473 setWindowState(Qt::WindowNoState); 519 474 hide(); 520 521 /* If there is mini-toolbar: */522 if (m_pMiniToolBar)523 {524 /* Hide mini-toolbar and reset it's state to NONE: */525 m_pMiniToolBar->setWindowState(Qt::WindowNoState);526 m_pMiniToolBar->hide();527 }528 475 } 529 476 /* If window should be shown and mapped to some host-screen: */ … … 536 483 /* Show window: */ 537 484 showFullScreen(); 538 539 /* If there is mini-toolbar: */540 if (m_pMiniToolBar)541 {542 /* Show mini-toolbar: */543 m_pMiniToolBar->showFullScreen();544 }545 485 546 486 /* Make sure window have appropriate geometry: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
r61884 r61965 30 30 # include <QStateMachine> 31 31 # include <QPainter> 32 # include <QDesktopWidget> 33 # ifdef VBOX_WS_WIN 34 # include <QWindow> 35 # endif /* VBOX_WS_WIN */ 32 36 33 37 /* GUI includes: */ … … 36 40 # include "UIIconPool.h" 37 41 # include "VBoxGlobal.h" 42 # ifdef VBOX_WS_X11 43 # include "UIExtraDataManager.h" 44 # endif /* VBOX_WS_X11 */ 38 45 39 46 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 555 562 } 556 563 564 void UIMiniToolBar::sltHide() 565 { 566 LogRel2(("GUI: UIMiniToolBar::sltHide\n")); 567 568 #if defined(VBOX_WS_MAC) 569 570 // Nothing 571 572 #elif defined(VBOX_WS_WIN) 573 574 /* Reset window state to NONE and hide it: */ 575 setWindowState(Qt::WindowNoState); 576 hide(); 577 578 #elif defined(VBOX_WS_X11) 579 580 /* Just hide window: */ 581 hide(); 582 583 #else 584 585 # warning "port me" 586 587 #endif 588 } 589 590 void UIMiniToolBar::sltShow() 591 { 592 LogRel2(("GUI: UIMiniToolBar::sltShow\n")); 593 594 #if defined(VBOX_WS_MAC) 595 596 // Nothing 597 598 #elif defined(VBOX_WS_WIN) 599 600 /* Adjust window before showing full-screen: */ 601 sltAdjust(); 602 showFullScreen(); 603 604 #elif defined(VBOX_WS_X11) 605 606 /* Show window full-screen before adjusting: */ 607 showFullScreen(); 608 sltAdjust(); 609 610 #else 611 612 # warning "port me" 613 614 #endif 615 } 616 617 void UIMiniToolBar::sltAdjust() 618 { 619 LogRel2(("GUI: UIMiniToolBar::sltAdjust\n")); 620 621 /* Get corresponding host-screen: */ 622 const int iHostScreen = QApplication::desktop()->screenNumber(parentWidget()); 623 Q_UNUSED(iHostScreen); 624 /* And corresponding working area: */ 625 const QRect workingArea = vboxGlobal().screenGeometry(iHostScreen); 626 Q_UNUSED(workingArea); 627 628 #if defined(VBOX_WS_MAC) 629 630 // Nothing 631 632 #elif defined(VBOX_WS_WIN) 633 634 # if QT_VERSION >= 0x050000 635 /* Map window onto required screen: */ 636 Assert(iHostScreen < qApp->screens().size()); 637 windowHandle()->setScreen(qApp->screens().at(iHostScreen)); 638 # endif /* QT_VERSION >= 0x050000 */ 639 /* Set appropriate window size: */ 640 resize(workingArea.size()); 641 # if QT_VERSION < 0x050000 642 /* Move window onto required screen: */ 643 move(workingArea.topLeft()); 644 # endif /* QT_VERSION < 0x050000 */ 645 646 #elif defined(VBOX_WS_X11) 647 648 /* Determine whether we should use the native full-screen mode: */ 649 const bool fUseNativeFullScreen = VBoxGlobal::supportsFullScreenMonitorsProtocolX11() && 650 !gEDataManager->legacyFullscreenModeRequested(); 651 if (fUseNativeFullScreen) 652 { 653 /* Tell recent window managers which host-screen this window should be mapped to: */ 654 VBoxGlobal::setFullScreenMonitorX11(this, iHostScreen); 655 } 656 657 /* Set appropriate window geometry: */ 658 resize(workingArea.size()); 659 move(workingArea.topLeft()); 660 661 /* Re-apply the full-screen state lost on above move(): */ 662 setWindowState(Qt::WindowFullScreen); 663 664 #else 665 666 # warning "port me" 667 668 #endif 669 } 670 557 671 void UIMiniToolBar::prepare() 558 672 { 559 /* Install own event-filter 560 * to handle window activation stealing: */ 673 /* Install event-filters: */ 561 674 installEventFilter(this); 675 parent()->installEventFilter(this); 562 676 563 677 #if defined(VBOX_WS_WIN) … … 719 833 } 720 834 835 /* If that's parent window event: */ 836 if (pWatched == parent()) 837 { 838 switch (pEvent->type()) 839 { 840 case QEvent::Hide: 841 { 842 /* Asynchronously call for sltHide(): */ 843 LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent hide event\n")); 844 QMetaObject::invokeMethod(this, "sltHide", Qt::QueuedConnection); 845 break; 846 } 847 case QEvent::Show: 848 { 849 /* Asynchronously call for sltShow(): */ 850 LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent show event\n")); 851 QMetaObject::invokeMethod(this, "sltShow", Qt::QueuedConnection); 852 break; 853 } 854 case QEvent::Move: 855 case QEvent::Resize: 856 { 857 /* Skip if parent or we are invisible: */ 858 if ( !parentWidget()->isVisible() 859 || !isVisible()) 860 break; 861 862 #if defined(VBOX_WS_MAC) 863 // Nothing 864 #elif defined(VBOX_WS_WIN) 865 /* Asynchronously call for sltShow() to adjust and expose both: */ 866 LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent move/resize event\n")); 867 QMetaObject::invokeMethod(this, "sltShow", Qt::QueuedConnection); 868 #elif defined(VBOX_WS_X11) 869 /* Asynchronously call for just sltAdjust() because it's enough: */ 870 LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent move/resize event\n")); 871 QMetaObject::invokeMethod(this, "sltAdjust", Qt::QueuedConnection); 872 #else 873 # warning "port me" 874 #endif 875 break; 876 } 877 default: 878 break; 879 } 880 } 881 721 882 /* Call to base-class: */ 722 883 return QWidget::eventFilter(pWatched, pEvent); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h
r61884 r61965 115 115 void sltNotifyAboutWindowActivationStolen() { emit sigNotifyAboutWindowActivationStolen(); } 116 116 117 /** Hides window. */ 118 void sltHide(); 119 /** Shows and adjusts window according to parent. */ 120 void sltShow(); 121 /** Adjusts window according to parent. */ 122 void sltAdjust(); 123 117 124 private: 118 125
Note:
See TracChangeset
for help on using the changeset viewer.