Changeset 65551 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 31, 2017 4:30:52 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
r65549 r65551 405 405 Qt::Alignment alignment, 406 406 bool fAutoHide /* = true */) 407 : QWidget( pParent, Qt::Tool| Qt::FramelessWindowHint)407 : QWidget(0, Qt::Window | Qt::FramelessWindowHint) 408 408 /* Variables: General stuff: */ 409 409 , m_pParent(pParent) … … 601 601 switch (m_geometryType) 602 602 { 603 case GeometryType_Available: show(); break; 604 case GeometryType_Full: showFullScreen(); break; 603 case GeometryType_Available: 604 { 605 /* Show normal: */ 606 show(); 607 break; 608 } 609 case GeometryType_Full: 610 { 611 /* Show full-screen: */ 612 showFullScreen(); 613 break; 614 } 605 615 } 606 616 … … 610 620 switch (m_geometryType) 611 621 { 612 case GeometryType_Available: show(); break; 613 case GeometryType_Full: showFullScreen(); break; 614 } 615 /* Adjust window: */ 616 sltAdjust(); 622 case GeometryType_Available: 623 { 624 /* Adjust window: */ 625 sltAdjust(); 626 /* Show maximized: */ 627 if (!isMaximized()) 628 showMaximized(); 629 break; 630 } 631 case GeometryType_Full: 632 { 633 /* Show full-screen: */ 634 showFullScreen(); 635 /* Adjust window: */ 636 sltAdjust(); 637 break; 638 } 639 } 617 640 618 641 #else … … 685 708 #elif defined(VBOX_WS_X11) 686 709 687 /* Determine whether we should use the native full-screen mode: */ 688 const bool fUseNativeFullScreen = VBoxGlobal::supportsFullScreenMonitorsProtocolX11() && 689 !gEDataManager->legacyFullscreenModeRequested(); 690 if (fUseNativeFullScreen) 691 { 692 /* Tell recent window managers which host-screen this window should be mapped to: */ 693 VBoxGlobal::setFullScreenMonitorX11(this, iHostScreen); 694 } 695 696 /* Set appropriate window size: */ 697 const QSize newSize = workingArea.size(); 698 LogRel(("GUI: UIMiniToolBar::sltAdjust: Resize window to: %dx%d\n", 699 newSize.width(), newSize.height())); 700 resize(newSize); 701 702 /* Move window onto required screen: */ 703 const QPoint newPosition = workingArea.topLeft(); 704 LogRel(("GUI: UIMiniToolBar::sltAdjust: Move window to: %dx%d\n", 705 newPosition.x(), newPosition.y())); 706 move(newPosition); 707 708 /* Re-apply the full-screen state lost on above move(): */ 709 setWindowState(Qt::WindowFullScreen); 710 switch (m_geometryType) 711 { 712 case GeometryType_Available: 713 { 714 /* Make sure we are located on corresponding host-screen: */ 715 if ( gpDesktop->screenCount() > 1 716 && (x() != workingArea.x() || y() != workingArea.y())) 717 { 718 // WORKAROUND: 719 // With Qt5 on KDE we can't just move the window onto desired host-screen if 720 // window is maximized. So we have to show it normal first of all: 721 if (isVisible() && isMaximized()) 722 showNormal(); 723 724 // WORKAROUND: 725 // With Qt5 on X11 we can't just move the window onto desired host-screen if 726 // window size is more than the available geometry (working area) of that 727 // host-screen. So we are resizing it to a smaller size first of all: 728 const QSize newSize = workingArea.size() * .9; 729 LogRel(("GUI: UIMiniToolBar::sltAdjust: Resize window to smaller size: %dx%d\n", 730 newSize.width(), newSize.height())); 731 resize(newSize); 732 733 /* Move window onto required screen: */ 734 const QPoint newPosition = workingArea.topLeft(); 735 LogRel(("GUI: UIMiniToolBar::sltAdjust: Move window to: %dx%d\n", 736 newPosition.x(), newPosition.y())); 737 move(newPosition); 738 } 739 740 break; 741 } 742 case GeometryType_Full: 743 { 744 /* Determine whether we should use the native full-screen mode: */ 745 const bool fUseNativeFullScreen = VBoxGlobal::supportsFullScreenMonitorsProtocolX11() && 746 !gEDataManager->legacyFullscreenModeRequested(); 747 if (fUseNativeFullScreen) 748 { 749 /* Tell recent window managers which host-screen this window should be mapped to: */ 750 VBoxGlobal::setFullScreenMonitorX11(this, iHostScreen); 751 } 752 753 /* Set appropriate window size: */ 754 const QSize newSize = workingArea.size(); 755 LogRel(("GUI: UIMiniToolBar::sltAdjust: Resize window to: %dx%d\n", 756 newSize.width(), newSize.height())); 757 resize(newSize); 758 759 /* Move window onto required screen: */ 760 const QPoint newPosition = workingArea.topLeft(); 761 LogRel(("GUI: UIMiniToolBar::sltAdjust: Move window to: %dx%d\n", 762 newPosition.x(), newPosition.y())); 763 move(newPosition); 764 765 /* Re-apply the full-screen state lost on above move(): */ 766 setWindowState(Qt::WindowFullScreen); 767 768 break; 769 } 770 } 710 771 711 772 #else … … 967 1028 break; 968 1029 969 #if defined(VBOX_WS_MAC) 970 // Nothing 971 #elif defined(VBOX_WS_WIN) 972 /* Asynchronously call for sltShow() to adjust and expose both: */ 1030 /* Asynchronously call for sltShow(): */ 973 1031 LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent move/resize event\n")); 974 1032 QMetaObject::invokeMethod(this, "sltShow", Qt::QueuedConnection); 975 #elif defined(VBOX_WS_X11)976 /* Asynchronously call for just sltAdjust() because it's enough: */977 LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent move/resize event\n"));978 QMetaObject::invokeMethod(this, "sltAdjust", Qt::QueuedConnection);979 #else980 # warning "port me"981 #endif982 1033 break; 983 1034 }
Note:
See TracChangeset
for help on using the changeset viewer.