- Timestamp:
- Jul 20, 2007 9:18:26 AM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h
r3674 r3728 95 95 void fixModifierState (LONG *codes, uint *count); 96 96 97 bool isInSeamlessMode();98 99 97 signals: 100 98 -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r3674 r3728 71 71 void refreshView(); 72 72 73 bool isTrueFullscreen() const { return full_screen; }73 bool isTrueFullscreen() const { return mIsInFullscreenMode; } 74 74 75 75 bool isTrueSeamless() const { return mIsInSeamlessMode; } 76 76 77 77 void setMouseIntegrationLocked (bool); 78 79 void popupSeamlessMenu(); 78 80 79 81 public slots: … … 115 117 void updateAppearanceOf (int element); 116 118 119 void toggleFullscreenMode (bool, bool); 120 117 121 private slots: 118 122 … … 175 179 176 180 private: 181 182 QPopupMenu *mSeamlessPopupMenu; 177 183 178 184 QActionGroup *runningActions; … … 282 288 283 289 // variables for dealing with true fullscreen 284 bool full_screen: 1;290 bool mIsInFullscreenMode : 1; 285 291 bool mIsInSeamlessMode : 1; 292 bool mIsSeamlessModeSupported : 1; 286 293 int normal_wflags; 287 294 bool was_max : 1; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r3702 r3728 965 965 { 966 966 VBoxSetRegionEvent *sre = (VBoxSetRegionEvent*) e; 967 mainwnd->setMask (sre->region()); 967 if (mainwnd->isTrueSeamless()) 968 mainwnd->setMask (sre->region()); 968 969 return true; 969 970 } … … 1124 1125 else if (ke->key() == Key_Home) 1125 1126 { 1126 mainwnd->menuBar()->setFocus(); 1127 if (mainwnd->isTrueSeamless()) 1128 mainwnd->popupSeamlessMenu(); 1129 else 1130 mainwnd->menuBar()->setFocus(); 1127 1131 } 1128 1132 else … … 1842 1846 } 1843 1847 1844 bool VBoxConsoleView::isInSeamlessMode()1845 {1846 return mainwnd->isTrueSeamless();1847 }1848 1849 1848 /** 1850 1849 * Called on exit from fullscreen or from maximized mode. -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r3719 r3728 52 52 #include <qpushbutton.h> 53 53 #include <qtoolbutton.h> 54 #include <qcursor.h> 54 55 55 56 #include <qeventloop.h> … … 214 215 WFlags aFlags) 215 216 : QMainWindow (aParent, aName, aFlags) 217 , mSeamlessPopupMenu (0) 216 218 #ifdef VBOX_WITH_DEBUGGER_GUI 217 219 , dbgStatisticsAction (NULL) … … 224 226 , machine_state (CEnums::InvalidMachineState) 225 227 , no_auto_close (false) 226 , full_screen(false)228 , mIsInFullscreenMode (false) 227 229 , mIsInSeamlessMode (false) 230 , mIsSeamlessModeSupported (false) 228 231 , normal_wflags (getWFlags()) 229 232 , was_max (false) … … 373 376 374 377 ///// Menubar /////////////////////////////////////////////////////////// 378 379 mSeamlessPopupMenu = new QPopupMenu (this, "mSeamlessPopupMenu"); 375 380 376 381 /* VM popup menu */ … … 400 405 vmDisMouseIntegrMenu = new VBoxSwitchMenu (vmMenu, vmDisableMouseIntegrAction, 401 406 true /* inverted toggle state */); 407 mSeamlessPopupMenu->insertItem (QString::null, vmMenu, vmMenuId); 402 408 403 409 /* Devices popup menu */ … … 439 445 devicesMenu->setItemParameter (devicesMountDVDMenuId, 0); 440 446 devicesMenu->setItemParameter (devicesUSBMenuId, 0); 447 mSeamlessPopupMenu->insertItem (QString::null, devicesMenu, devicesMenuId); 441 448 442 449 #ifdef VBOX_WITH_DEBUGGER_GUI … … 448 455 dbgCommandLineAction->addTo (dbgMenu); 449 456 menuBar()->insertItem (QString::null, dbgMenu, dbgMenuId); 457 mSeamlessPopupMenu->insertItem (QString::null, dbgMenu, dbgMenuId); 450 458 } 451 459 else … … 462 470 helpResetMessagesAction->addTo (helpMenu); 463 471 menuBar()->insertItem( QString::null, helpMenu, helpMenuId ); 472 mSeamlessPopupMenu->insertItem (QString::null, helpMenu, helpMenuId); 464 473 465 474 ///// Status bar //////////////////////////////////////////////////////// … … 777 786 normal_pos = QPoint (x, y); 778 787 normal_size = QSize (w, h); 779 if (! full_screen&& !vmSeamlessAction->isOn())788 if (!mIsInFullscreenMode && !vmSeamlessAction->isOn()) 780 789 { 781 790 move (normal_pos); … … 794 803 normal_pos = QPoint(); 795 804 normal_size = QSize(); 796 if (! full_screen&& !vmSeamlessAction->isOn())805 if (!mIsInFullscreenMode && !vmSeamlessAction->isOn()) 797 806 { 798 807 console->normalizeGeometry (true /* adjustPosition */); … … 1030 1039 .arg (normal_size.width()) 1031 1040 .arg (normal_size.height()); 1032 if (isMaximized() || ( full_screen&& was_max)1041 if (isMaximized() || (mIsInFullscreenMode && was_max) 1033 1042 || (mIsInSeamlessMode && was_max)) 1034 1043 winPos += QString (",%1").arg (GUI_LastWindowPosition_Max); … … 1073 1082 } 1074 1083 1084 void VBoxConsoleWnd::popupSeamlessMenu() 1085 { 1086 mSeamlessPopupMenu->popup (QCursor::pos()); 1087 } 1088 1075 1089 // 1076 1090 // Protected Members … … 1088 1102 { 1089 1103 QResizeEvent *re = (QResizeEvent *) e; 1090 if (! full_screen&& !mIsInSeamlessMode &&1104 if (!mIsInFullscreenMode && !mIsInSeamlessMode && 1091 1105 (windowState() & (WindowMaximized | WindowMinimized | 1092 1106 WindowFullScreen)) == 0) … … 1101 1115 case QEvent::Move: 1102 1116 { 1103 if (! full_screen&& !mIsInSeamlessMode &&1117 if (!mIsInFullscreenMode && !mIsInSeamlessMode && 1104 1118 (windowState() & (WindowMaximized | WindowMinimized | 1105 1119 WindowFullScreen)) == 0) … … 1478 1492 devicesMenu->changeItem (devicesUSBMenuId, tr ("&USB Devices")); 1479 1493 1494 /* main menu & seamless popup menu */ 1495 1480 1496 menuBar()->changeItem (vmMenuId, tr ("&Machine")); 1497 mSeamlessPopupMenu->changeItem (vmMenuId, 1498 VBoxGlobal::iconSet ("ico16x01.png"), tr ("&Machine")); 1481 1499 menuBar()->changeItem (devicesMenuId, tr ("&Devices")); 1500 mSeamlessPopupMenu->changeItem (devicesMenuId, 1501 VBoxGlobal::iconSet ("diskim_16px.png"), tr ("&Devices")); 1482 1502 #ifdef VBOX_WITH_DEBUGGER_GUI 1483 1503 if (vboxGlobal().isDebuggerEnabled()) 1504 { 1484 1505 menuBar()->changeItem (dbgMenuId, tr ("De&bug")); 1506 mSeamlessPopupMenu->changeItem (dbgMenuId, 1507 VBoxGlobal::iconSet ("global_settings_16px.png"), tr ("De&bug")); 1508 } 1485 1509 #endif 1486 1510 menuBar()->changeItem (helpMenuId, tr ("&Help")); 1511 mSeamlessPopupMenu->changeItem (helpMenuId, 1512 VBoxGlobal::iconSet ("help_16px.png"), tr ("&Help")); 1487 1513 1488 1514 /* status bar widgets */ … … 1760 1786 } 1761 1787 1762 // 1763 // Private slots 1764 ///////////////////////////////////////////////////////////////////////////// 1765 1766 void VBoxConsoleWnd::vmFullscreen (bool on) 1767 { 1788 void VBoxConsoleWnd::toggleFullscreenMode (bool aOn, bool aSeamless) 1789 { 1790 if (aSeamless && 1791 (aOn && !mIsSeamlessModeSupported || 1792 aOn && mIsInFullscreenMode || 1793 !aOn && !mIsInSeamlessMode)) 1794 return; 1795 1768 1796 AssertReturnVoid (console); 1769 AssertReturnVoid (full_screen != on); 1770 AssertReturnVoid ((hidden_children.isEmpty() == on)); 1771 1772 if (on) 1773 { 1774 /* take the Fullscreen hot key from the menu item */ 1775 QString hotKey = vmFullscreenAction->menuText(); 1797 AssertReturnVoid ((hidden_children.isEmpty() == aOn)); 1798 if (aSeamless) 1799 AssertReturnVoid (mIsInSeamlessMode != aOn); 1800 else 1801 AssertReturnVoid (mIsInFullscreenMode != aOn); 1802 1803 if (aOn) 1804 { 1805 /* take the toggle hot key from the menu item */ 1806 QString hotKey = aSeamless ? vmSeamlessAction->menuText() : 1807 vmFullscreenAction->menuText(); 1776 1808 hotKey = QStringList::split ('\t', hotKey) [1]; 1777 1809 Assert (!hotKey.isEmpty()); 1778 1810 /* get the host key name */ 1779 QString hostKey = QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey()); 1811 QString hostKey = QIHotKeyEdit::keyName (vboxGlobal().settings() 1812 .hostKey()); 1780 1813 /* show the info message */ 1781 vboxProblem().remindAboutGoingFullscreen (hotKey, hostKey); 1782 } 1783 1784 full_screen = on; 1785 1786 vmAdjustWindowAction->setEnabled (!on); 1787 vmSeamlessAction->setEnabled (!on); 1814 aSeamless ? vboxProblem().remindAboutGoingSeamless (hotKey, hostKey) : 1815 vboxProblem().remindAboutGoingFullscreen (hotKey, hostKey); 1816 } 1817 1818 if (aSeamless) 1819 { 1820 /* activate the auto-resize feature required for the seamless mode */ 1821 if (!vmAutoresizeGuestAction->isOn()) 1822 vmAutoresizeGuestAction->setOn (true); 1823 1824 /* activate the mouse integration feature for the seamless mode */ 1825 if (vmDisableMouseIntegrAction->isOn()) 1826 vmDisableMouseIntegrAction->setOn (false); 1827 1828 vmAdjustWindowAction->setEnabled (!aOn); 1829 vmFullscreenAction->setEnabled (!aOn); 1830 vmAutoresizeGuestAction->setEnabled (!aOn); 1831 vmDisableMouseIntegrAction->setEnabled (!aOn); 1832 } 1833 else 1834 { 1835 mIsInFullscreenMode = aOn; 1836 vmAdjustWindowAction->setEnabled (!aOn); 1837 vmSeamlessAction->setEnabled (!aOn); 1838 } 1788 1839 1789 1840 bool wasHidden = isHidden(); 1790 1841 1791 if (on) 1792 { 1842 if (aOn) 1843 { 1844 if (aSeamless) 1845 mIsInSeamlessMode = true; 1846 1793 1847 /* Save the previous scroll-view minimum size before entering 1794 * fullscreen state to restore this minimum size before the exiting1795 * fullscreen. Required for correct scroll-view and guest display1796 * update in SDL mode. */1848 * fullscreen/seamless state to restore this minimum size before 1849 * the exiting fullscreen. Required for correct scroll-view and 1850 * guest display update in SDL mode. */ 1797 1851 prev_min_size = console->minimumSize(); 1798 1852 console->setMinimumSize (0, 0); … … 1800 1854 /* memorize the maximized state */ 1801 1855 was_max = isMaximized(); 1856 1802 1857 /* set the correct flags to disable unnecessary frame controls */ 1803 int flags = WType_TopLevel | WStyle_Customize | WStyle_NoBorder | 1804 WStyle_StaysOnTop; 1805 QRect scrGeo = QApplication::desktop()->screenGeometry (this); 1858 int flags = WType_TopLevel | WStyle_Customize | WStyle_NoBorder; 1859 if (!aSeamless) 1860 flags |= WStyle_StaysOnTop; 1861 1862 /* let the widget take the whole available desktop space */ 1863 QRect scrGeo = aSeamless ? 1864 QApplication::desktop()->availableGeometry (this) : 1865 QApplication::desktop()->screenGeometry (this); 1866 1806 1867 /* hide early to avoid extra flicker */ 1807 1868 hide(); … … 1821 1882 } 1822 1883 delete list; 1823 /* reparet to apply new flags and place to the top left corner of the 1884 1885 /* reparent to apply new flags and place to the top left corner of the 1824 1886 * current desktop */ 1825 1887 reparent (parentWidget(), flags, QPoint (scrGeo.x(), scrGeo.y()), false); 1826 1888 /* reattaching application icon after window reparenting */ 1827 1889 setIcon (QPixmap::fromMimeSource ("ico40x01.png")); 1890 1828 1891 /* adjust colors and appearance */ 1829 1892 erase_color = centralWidget()->eraseColor(); … … 1834 1897 console->setVScrollBarMode (QScrollView::AlwaysOff); 1835 1898 console->setHScrollBarMode (QScrollView::AlwaysOff); 1899 1836 1900 /* go fullscreen */ 1837 1901 resize (scrGeo.size()); 1838 1902 setMinimumSize (size()); 1839 1903 setMaximumSize (size()); 1904 1840 1905 #ifdef Q_WS_MAC 1841 /* make the apple menu bar go away. */ 1842 OSStatus orc = SetSystemUIMode (kUIModeAllHidden, kUIOptionDisableAppleMenu); 1843 if (orc) 1844 LogRel (("Error: Failed to change UI mode (rc=%#x) when changing to fullscreen mode. (=> menu bar trouble)\n", orc)); 1906 if (!aSeamless) 1907 { 1908 /* make the apple menu bar go away. */ 1909 OSStatus orc = SetSystemUIMode (kUIModeAllHidden, 1910 kUIOptionDisableAppleMenu); 1911 if (orc) 1912 LogRel (("Error: Failed to change UI mode (rc=%#x) when changing to fullscreen mode. (=> menu bar trouble)\n", orc)); 1913 } 1845 1914 #endif 1846 1915 } … … 1852 1921 console->setMinimumSize (prev_min_size); 1853 1922 1923 #ifdef Q_WS_MAC 1924 if (!aSeamless) 1925 { 1926 SetSystemUIMode (kUIModeNormal, 0); 1927 } 1928 #endif 1929 1854 1930 /* hide early to avoid extra flicker */ 1855 #ifdef Q_WS_MAC1856 SetSystemUIMode (kUIModeNormal, 0);1857 #endif1858 1931 hide(); 1859 /* reparet to restore normal flags */ 1932 1933 /* reparent to restore normal flags */ 1860 1934 reparent (parentWidget(), normal_wflags, QPoint (0, 0), false); 1861 1935 /* reattaching application icon after window reparenting */ 1862 1936 setIcon (QPixmap::fromMimeSource ("ico40x01.png")); 1937 1863 1938 /* adjust colors and appearance */ 1864 1939 centralWidget()->setEraseColor (erase_color); … … 1867 1942 console->setVScrollBarMode (QScrollView::Auto); 1868 1943 console->setHScrollBarMode (QScrollView::Auto); 1944 1869 1945 /* show everything hidden when going fullscreen */ 1870 1946 for (QObject *obj = hidden_children.first(); obj != NULL; … … 1872 1948 ((QWidget *) obj)->show(); 1873 1949 hidden_children.clear(); 1950 1874 1951 /* restore normal values */ 1875 1952 setMinimumSize (QSize(0, 0)); 1876 1953 setMaximumSize (QSize (QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); 1877 move (normal_pos); 1878 resize (normal_size); 1954 1955 if (aSeamless) 1956 { 1957 if (was_max) 1958 { 1959 /* restore the maximized state */ 1960 setWindowState (windowState() | WindowMaximized); 1961 } 1962 else 1963 { 1964 move (normal_pos); 1965 resize (normal_size); 1966 QTimer::singleShot (200, console, SLOT (exitFullScreen())); 1967 } 1968 } 1969 else 1970 { 1971 move (normal_pos); 1972 resize (normal_size); 1973 /* restore the maximized state */ 1974 if (was_max) 1975 setWindowState (windowState() | WindowMaximized); 1976 else 1977 QTimer::singleShot (0, console, SLOT (exitFullScreen())); 1978 } 1979 1879 1980 /* let our toplevel widget calculate its sizeHint properly */ 1880 1981 QApplication::sendPostedEvents (0, QEvent::LayoutHint); 1881 /* restore the maximized state */ 1882 if (was_max) 1883 setWindowState (windowState() | WindowMaximized); 1884 else 1885 QTimer::singleShot (0, console, SLOT (exitFullScreen())); 1982 1983 if (aSeamless) 1984 mIsInSeamlessMode = false; 1886 1985 } 1887 1986 … … 1894 1993 } 1895 1994 1896 void VBoxConsoleWnd::vmSeamless (bool on) 1897 { 1898 if (on && !vmSeamlessAction->isEnabled() || 1899 !on && !mIsInSeamlessMode || 1900 on && full_screen) 1901 return; 1902 1903 AssertReturnVoid (console); 1904 AssertReturnVoid (mIsInSeamlessMode != on); 1905 AssertReturnVoid ((hidden_children.isEmpty() == on)); 1906 1907 if (on) 1908 { 1909 /* take the Seamless hot key from the menu item */ 1910 QString hotKey = vmSeamlessAction->menuText(); 1911 hotKey = QStringList::split ('\t', hotKey) [1]; 1912 Assert (!hotKey.isEmpty()); 1913 /* get the host key name */ 1914 QString hostKey = QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey()); 1915 /* show the info message */ 1916 vboxProblem().remindAboutGoingSeamless (hotKey, hostKey); 1917 } 1918 1919 /* activate the auto-resize feature required for the seamless mode */ 1920 if (!vmAutoresizeGuestAction->isOn()) 1921 vmAutoresizeGuestAction->setOn (true); 1922 1923 vmAdjustWindowAction->setEnabled (!on); 1924 vmFullscreenAction->setEnabled (!on); 1925 vmAutoresizeGuestAction->setEnabled (!on); 1926 1927 bool wasHidden = isHidden(); 1928 1929 if (on) 1930 { 1931 mIsInSeamlessMode = true; 1932 1933 /* Save the previous scroll-view minimum size before entering 1934 * seamless state to restore this minimum size before the exiting 1935 * seamless mode. Required for correct scroll-view and guest display 1936 * update in SDL mode. */ 1937 prev_min_size = console->minimumSize(); 1938 console->setMinimumSize (0, 0); 1939 1940 /* memorize the maximized state */ 1941 was_max = isMaximized(); 1942 /* set the correct flags to disable unnecessary frame controls */ 1943 int flags = WType_TopLevel | WStyle_Customize | WStyle_NoBorder; 1944 /* let the widget take the whole available desktop space */ 1945 QRect scrGeo = QApplication::desktop()->availableGeometry (this); 1946 /* hide early to avoid extra flicker */ 1947 hide(); 1948 /* hide all but the central widget containing the console view */ 1949 QObjectList *list = queryList (NULL, NULL, false, false); 1950 for (QObject *obj = list->first(); obj != NULL; obj = list->next()) 1951 { 1952 if (obj->isWidgetType() && obj != centralWidget()) 1953 { 1954 QWidget *w = (QWidget *) obj; 1955 if (!w->isHidden()) 1956 { 1957 w->hide(); 1958 hidden_children.append (w); 1959 } 1960 } 1961 } 1962 delete list; 1963 /* reparent to apply new flags and place to the top left corner of the 1964 * current desktop */ 1965 reparent (parentWidget(), flags, QPoint (scrGeo.x(), scrGeo.y()), false); 1966 /* reattaching application icon after window reparenting */ 1967 setIcon (QPixmap::fromMimeSource ("ico40x01.png")); 1968 /* adjust colors and appearance */ 1969 console_style = console->frameStyle(); 1970 console->setFrameStyle (QFrame::NoFrame); 1971 console->setMaximumSize (console->sizeHint()); 1972 console->setVScrollBarMode (QScrollView::AlwaysOff); 1973 console->setHScrollBarMode (QScrollView::AlwaysOff); 1974 /* go full available screen */ 1975 resize (scrGeo.size()); 1976 setMinimumSize (size()); 1977 setMaximumSize (size()); 1978 } 1979 else 1980 { 1981 /* Restore the previous scroll-view minimum size before the exiting 1982 * seamless mode. Required for correct scroll-view and guest display 1983 * update in SDL mode. */ 1984 console->setMinimumSize (prev_min_size); 1985 1986 /* hide early to avoid extra flicker */ 1987 hide(); 1988 /* reparent to restore normal flags */ 1989 reparent (parentWidget(), normal_wflags, QPoint (0, 0), false); 1990 /* reattaching application icon after window reparenting */ 1991 setIcon (QPixmap::fromMimeSource ("ico40x01.png")); 1992 /* adjust colors and appearance */ 1993 console->setFrameStyle (console_style); 1994 console->setMaximumSize (console->sizeHint()); 1995 console->setVScrollBarMode (QScrollView::Auto); 1996 console->setHScrollBarMode (QScrollView::Auto); 1997 /* show everything hidden when going fullscreen */ 1998 for (QObject *obj = hidden_children.first(); obj != NULL; 1999 obj = hidden_children.next()) 2000 ((QWidget *) obj)->show(); 2001 hidden_children.clear(); 2002 /* restore normal values */ 2003 setMinimumSize (QSize(0, 0)); 2004 setMaximumSize (QSize (QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); 2005 2006 if (was_max) 2007 { 2008 /* restore the maximized state */ 2009 setWindowState (windowState() | WindowMaximized); 2010 } 2011 else 2012 { 2013 move (normal_pos); 2014 resize (normal_size); 2015 QTimer::singleShot (0, console, SLOT (exitFullScreen())); 2016 } 2017 /* let our toplevel widget calculate its sizeHint properly */ 2018 QApplication::sendPostedEvents (0, QEvent::LayoutHint); 2019 2020 mIsInSeamlessMode = false; 2021 } 2022 2023 /* VBoxConsoleView loses focus for some reason after reparenting, 2024 * restore it */ 2025 console->setFocus(); 2026 2027 if (!wasHidden) 2028 show(); 1995 // 1996 // Private slots 1997 ///////////////////////////////////////////////////////////////////////////// 1998 1999 void VBoxConsoleWnd::vmFullscreen (bool aOn) 2000 { 2001 toggleFullscreenMode (aOn, false); 2002 } 2003 2004 void VBoxConsoleWnd::vmSeamless (bool aOn) 2005 { 2006 toggleFullscreenMode (aOn, true); 2029 2007 } 2030 2008 … … 2781 2759 vmAutoresizeGuestAction->setEnabled (aActive); 2782 2760 vmSeamlessAction->setEnabled (aSeamless); 2761 mIsSeamlessModeSupported = aSeamless; 2783 2762 if (aSeamless && vmSeamlessAction->isOn()) 2784 2763 vmSeamless (true); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFrameBuffer.cpp
r3674 r3728 281 281 if (!rects) 282 282 return E_POINTER; 283 284 if (!mView->isInSeamlessMode())285 return S_OK;286 283 287 284 QRegion reg;
Note:
See TracChangeset
for help on using the changeset viewer.