Changeset 3674 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 17, 2007 4:12:36 PM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h
r2981 r3674 95 95 void fixModifierState (LONG *codes, uint *count); 96 96 97 bool isInSeamlessMode(); 98 97 99 signals: 98 100 … … 100 102 void mouseStateChanged (int state); 101 103 void machineStateChanged (CEnums::MachineState state); 102 void additionsStateChanged (const QString &, bool );104 void additionsStateChanged (const QString &, bool, bool); 103 105 104 106 protected: -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r3490 r3674 73 73 bool isTrueFullscreen() const { return full_screen; } 74 74 75 bool isTrueSeamless() const { return mIsInSeamlessMode; } 76 75 77 void setMouseIntegrationLocked (bool); 76 78 … … 120 122 121 123 void vmFullscreen (bool on); 124 void vmSeamless (bool on); 122 125 void vmAutoresizeGuest (bool on); 123 126 void vmAdjustWindow(); … … 162 165 void updateMouseState (int state); 163 166 164 void updateAdditionsState (const QString&, bool );167 void updateAdditionsState (const QString&, bool, bool); 165 168 166 169 void tryClose(); … … 177 180 // VM actions 178 181 QAction *vmFullscreenAction; 182 QAction *vmSeamlessAction; 179 183 QAction *vmAutoresizeGuestAction; 180 184 QAction *vmAdjustWindowAction; … … 279 283 // variables for dealing with true fullscreen 280 284 bool full_screen : 1; 285 bool mIsInSeamlessMode : 1; 281 286 int normal_wflags; 282 287 bool was_max : 1; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h
r3483 r3674 125 125 ResizeEventType = QEvent::User, 126 126 RepaintEventType, 127 SetRegionEventType, 127 128 MouseCapabilityEventType, 128 129 MousePointerChangeEventType, … … 143 144 #if defined (Q_WS_MAC) 144 145 ShowWindowEventType, 145 #endif 146 #endif 146 147 }; 147 148 }; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h
r3614 r3674 104 104 private: 105 105 int ex, ey, ew, eh; 106 }; 107 108 /** 109 * Frame buffer set region event. 110 */ 111 class VBoxSetRegionEvent : public QEvent 112 { 113 public: 114 VBoxSetRegionEvent (const QRegion &aReg) 115 : QEvent ((QEvent::Type) VBoxDefs::SetRegionEventType) 116 , mReg (aReg) {} 117 QRegion region() { return mReg; } 118 private: 119 QRegion mReg; 106 120 }; 107 121 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r3483 r3674 231 231 GuestAdditionsEvent (const QString &aOsTypeId, 232 232 const QString &aAddVersion, 233 bool aAddActive) : 233 bool aAddActive, 234 bool aSeamlessActive) : 234 235 QEvent ((QEvent::Type) VBoxDefs::AdditionsStateChangeEventType), 235 mOsTypeId (aOsTypeId), mAddVersion (aAddVersion), mAddActive (aAddActive) {} 236 mOsTypeId (aOsTypeId), mAddVersion (aAddVersion), 237 mAddActive (aAddActive), mSeamlessActive (aSeamlessActive) {} 236 238 const QString &osTypeId() const { return mOsTypeId; } 237 239 const QString &additionVersion() const { return mAddVersion; } 238 240 bool additionActive() const { return mAddActive; } 241 bool seamlessActive() const { return mSeamlessActive; } 239 242 private: 240 243 QString mOsTypeId; 241 244 QString mAddVersion; 242 245 bool mAddActive; 246 bool mSeamlessActive; 243 247 }; 244 248 … … 391 395 guest.GetOSTypeId(), 392 396 guest.GetAdditionsVersion(), 393 guest.GetAdditionsActive())); 397 guest.GetAdditionsActive(), 398 guest.GetSeamlessSupport())); 394 399 return S_OK; 395 400 } … … 935 940 * full screen */ 936 941 if (!mainwnd->isTrueFullscreen() && 942 !mainwnd->isTrueSeamless() && 937 943 !topLevelWidget()->isMaximized()) 938 944 normalizeGeometry (true /* adjustPosition */); … … 955 961 } 956 962 #endif /* Q_WS_MAC */ 963 964 case VBoxDefs::SetRegionEventType: 965 { 966 VBoxSetRegionEvent *sre = (VBoxSetRegionEvent*) e; 967 mainwnd->setMask (sre->region()); 968 return true; 969 } 957 970 958 971 case VBoxDefs::MousePointerChangeEventType: … … 1022 1035 maybeRestrictMinimumSize(); 1023 1036 1024 emit additionsStateChanged (ge->additionVersion(), ge->additionActive()); 1037 emit additionsStateChanged (ge->additionVersion(), 1038 ge->additionActive(), 1039 ge->seamlessActive()); 1025 1040 return true; 1026 1041 } … … 1261 1276 * variable should be set to true here in case of mainwnd is 1262 1277 * maximized or in fullscreen state. */ 1263 if (mainwnd->isMaximized() || mainwnd->isTrueFullscreen()) 1278 if (mainwnd->isMaximized() || mainwnd->isTrueFullscreen() 1279 || mainwnd->isTrueSeamless()) 1264 1280 ignore_mainwnd_resize = true; 1265 1281 } … … 1273 1289 if (!mainwnd->isMinimized() && 1274 1290 !mainwnd->isMaximized() && 1275 !mainwnd->isTrueFullscreen()) 1291 !mainwnd->isTrueFullscreen() && 1292 !mainwnd->isTrueSeamless()) 1276 1293 QTimer::singleShot (0, this, SLOT (exitFullScreen())); 1277 1294 } … … 1824 1841 } 1825 1842 1843 bool VBoxConsoleView::isInSeamlessMode() 1844 { 1845 return mainwnd->isTrueSeamless(); 1846 } 1847 1826 1848 /** 1827 1849 * Called on exit from fullscreen or from maximized mode. -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r3547 r3674 225 225 , no_auto_close (false) 226 226 , full_screen (false) 227 , mIsInSeamlessMode (false) 227 228 , normal_wflags (getWFlags()) 228 229 , was_max (false) … … 271 272 vmFullscreenAction->setToggleAction (true); 272 273 274 vmSeamlessAction = new QAction (this, "vmSeamlessAction"); 275 vmSeamlessAction->setIconSet ( 276 VBoxGlobal::iconSet ("nw_16px.png", "nw_disabled_16px.png")); 277 vmSeamlessAction->setToggleAction (true); 278 273 279 vmAutoresizeGuestAction = new QAction (runningActions, "vmAutoresizeGuestAction"); 274 280 vmAutoresizeGuestAction->setIconSet ( … … 372 378 QPopupMenu *vmMenu = new QPopupMenu (this, "vmMenu"); 373 379 vmFullscreenAction->addTo (vmMenu); 380 vmSeamlessAction->addTo (vmMenu); 374 381 vmAdjustWindowAction->addTo (vmMenu); 375 382 vmAutoresizeGuestAction->addTo (vmMenu); … … 536 543 connect (vmFullscreenAction, SIGNAL (toggled (bool)), 537 544 this, SLOT (vmFullscreen (bool))); 545 connect (vmSeamlessAction, SIGNAL (toggled (bool)), 546 this, SLOT (vmSeamless (bool))); 538 547 connect (vmAutoresizeGuestAction, SIGNAL (toggled (bool)), 539 548 this, SLOT (vmAutoresizeGuest (bool))); … … 679 688 680 689 static const char *GUI_Fullscreen = "GUI/Fullscreen"; 690 static const char *GUI_Seamless = "GUI/Seamless"; 681 691 static const char *GUI_AutoresizeGuest = "GUI/AutoresizeGuest"; 682 692 extern const char *GUI_FirstRun = "GUI/FirstRun"; … … 729 739 if (str == "on") 730 740 vmFullscreenAction->setOn (true); 741 742 vmSeamlessAction->setEnabled (false); 743 str = cmachine.GetExtraData (GUI_Seamless); 744 if (str == "on") 745 vmSeamlessAction->setOn (true); 731 746 732 747 str = cmachine.GetExtraData (GUI_AutoresizeGuest); … … 762 777 normal_pos = QPoint (x, y); 763 778 normal_size = QSize (w, h); 764 if (!full_screen )779 if (!full_screen && !vmSeamlessAction->isOn()) 765 780 { 766 781 move (normal_pos); … … 779 794 normal_pos = QPoint(); 780 795 normal_size = QSize(); 781 if (!full_screen )796 if (!full_screen && !vmSeamlessAction->isOn()) 782 797 { 783 798 console->normalizeGeometry (true /* adjustPosition */); … … 845 860 connect (console, SIGNAL (machineStateChanged (CEnums::MachineState)), 846 861 this, SLOT (updateMachineState (CEnums::MachineState))); 847 connect (console, SIGNAL (additionsStateChanged (const QString&, bool )),848 this, SLOT (updateAdditionsState (const QString &, bool )));862 connect (console, SIGNAL (additionsStateChanged (const QString&, bool, bool)), 863 this, SLOT (updateAdditionsState (const QString &, bool, bool))); 849 864 850 865 #ifdef Q_WS_MAC … … 1015 1030 .arg (normal_size.width()) 1016 1031 .arg (normal_size.height()); 1017 if (isMaximized() || (full_screen && was_max)) 1032 if (isMaximized() || (full_screen && was_max) 1033 || (mIsInSeamlessMode && was_max)) 1018 1034 winPos += QString (",%1").arg (GUI_LastWindowPosition_Max); 1019 1035 … … 1022 1038 machine.SetExtraData (GUI_Fullscreen, 1023 1039 vmFullscreenAction->isOn() ? "on" : "off"); 1040 machine.SetExtraData (GUI_Seamless, 1041 vmSeamlessAction->isOn() ? "on" : "off"); 1024 1042 machine.SetExtraData (GUI_AutoresizeGuest, 1025 1043 vmAutoresizeGuestAction->isOn() ? "on" : "off"); … … 1070 1088 { 1071 1089 QResizeEvent *re = (QResizeEvent *) e; 1072 if (!full_screen && 1090 if (!full_screen && !mIsInSeamlessMode && 1073 1091 (windowState() & (WindowMaximized | WindowMinimized | 1074 1092 WindowFullScreen)) == 0) … … 1083 1101 case QEvent::Move: 1084 1102 { 1085 if (!full_screen && 1103 if (!full_screen && !mIsInSeamlessMode && 1086 1104 (windowState() & (WindowMaximized | WindowMinimized | 1087 1105 WindowFullScreen)) == 0) … … 1354 1372 vmFullscreenAction->setStatusTip (tr ("Switch to fullscreen mode" )); 1355 1373 1374 vmSeamlessAction->setMenuText (tr ("&Seamless Mode") + "\tHost+S"); 1375 vmSeamlessAction->setStatusTip (tr ("Switch to seamless mode")); 1376 1356 1377 vmDisMouseIntegrMenu->setToolTip (tr ("Mouse Integration", 1357 1378 "enable/disable...")); … … 1764 1785 1765 1786 vmAdjustWindowAction->setEnabled (!on); 1787 vmSeamlessAction->setEnabled (!on); 1766 1788 1767 1789 bool wasHidden = isHidden(); … … 1856 1878 if (was_max) 1857 1879 setWindowState (windowState() | WindowMaximized); 1858 QTimer::singleShot (0, console, SLOT (exitFullScreen())); 1880 else 1881 QTimer::singleShot (0, console, SLOT (exitFullScreen())); 1882 } 1883 1884 /* VBoxConsoleView loses focus for some reason after reparenting, 1885 * restore it */ 1886 console->setFocus(); 1887 1888 if (!wasHidden) 1889 show(); 1890 } 1891 1892 void VBoxConsoleWnd::vmSeamless (bool on) 1893 { 1894 if (on && !vmSeamlessAction->isEnabled() || 1895 !on && !mIsInSeamlessMode || 1896 on && full_screen) 1897 return; 1898 1899 AssertReturnVoid (console); 1900 AssertReturnVoid (mIsInSeamlessMode != on); 1901 AssertReturnVoid ((hidden_children.isEmpty() == on)); 1902 1903 /* activate the auto-resize feature required for the seamless mode */ 1904 if (!vmAutoresizeGuestAction->isOn()) 1905 vmAutoresizeGuestAction->setOn (true); 1906 mIsInSeamlessMode = on; 1907 1908 vmAdjustWindowAction->setEnabled (!on); 1909 vmFullscreenAction->setEnabled (!on); 1910 vmAutoresizeGuestAction->setEnabled (!on); 1911 1912 bool wasHidden = isHidden(); 1913 1914 if (on) 1915 { 1916 /* Save the previous scroll-view minimum size before entering 1917 * fullscreen state to restore this minimum size before the exiting 1918 * fullscreen. Required for correct scroll-view and guest display 1919 * update in SDL mode. */ 1920 prev_min_size = console->minimumSize(); 1921 console->setMinimumSize (0, 0); 1922 1923 /* memorize the maximized state */ 1924 was_max = isMaximized(); 1925 /* set the correct flags to disable unnecessary frame controls */ 1926 int flags = WType_TopLevel | WStyle_Customize | WStyle_NoBorder; 1927 QRect scrGeo = QApplication::desktop()->availableGeometry (this); 1928 /* hide early to avoid extra flicker */ 1929 hide(); 1930 /* hide all but the central widget containing the console view */ 1931 QObjectList *list = queryList (NULL, NULL, false, false); 1932 for (QObject *obj = list->first(); obj != NULL; obj = list->next()) 1933 { 1934 if (obj->isWidgetType() && obj != centralWidget()) 1935 { 1936 QWidget *w = (QWidget *) obj; 1937 if (!w->isHidden()) 1938 { 1939 w->hide(); 1940 hidden_children.append (w); 1941 } 1942 } 1943 } 1944 delete list; 1945 /* reparent to apply new flags and place to the top left corner of the 1946 * current desktop */ 1947 reparent (parentWidget(), flags, QPoint (scrGeo.x(), scrGeo.y()), false); 1948 /* adjust colors and appearance */ 1949 console_style = console->frameStyle(); 1950 console->setFrameStyle (QFrame::NoFrame); 1951 console->setMaximumSize (console->sizeHint()); 1952 console->setVScrollBarMode (QScrollView::AlwaysOff); 1953 console->setHScrollBarMode (QScrollView::AlwaysOff); 1954 /* go full available screen */ 1955 resize (scrGeo.size()); 1956 setMinimumSize (size()); 1957 setMaximumSize (size()); 1958 } 1959 else 1960 { 1961 /* Restore the previous scroll-view minimum size before the exiting 1962 * fullscreen. Required for correct scroll-view and guest display 1963 * update in SDL mode. */ 1964 console->setMinimumSize (prev_min_size); 1965 1966 /* hide early to avoid extra flicker */ 1967 hide(); 1968 /* reparent to restore normal flags */ 1969 reparent (parentWidget(), normal_wflags, QPoint (0, 0), false); 1970 /* adjust colors and appearance */ 1971 console->setFrameStyle (console_style); 1972 console->setMaximumSize (console->sizeHint()); 1973 console->setVScrollBarMode (QScrollView::Auto); 1974 console->setHScrollBarMode (QScrollView::Auto); 1975 /* show everything hidden when going fullscreen */ 1976 for (QObject *obj = hidden_children.first(); obj != NULL; 1977 obj = hidden_children.next()) 1978 ((QWidget *) obj)->show(); 1979 hidden_children.clear(); 1980 /* restore normal values */ 1981 setMinimumSize (QSize(0, 0)); 1982 setMaximumSize (QSize (QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); 1983 move (normal_pos); 1984 resize (normal_size); 1985 /* let our toplevel widget calculate its sizeHint properly */ 1986 QApplication::sendPostedEvents (0, QEvent::LayoutHint); 1987 /* restore the maximized state */ 1988 if (was_max) 1989 setWindowState (windowState() | WindowMaximized); 1990 else 1991 QTimer::singleShot (0, console, SLOT (exitFullScreen())); 1859 1992 } 1860 1993 … … 2613 2746 2614 2747 2615 void VBoxConsoleWnd::updateAdditionsState (const QString &aVersion, bool aActive) 2748 void VBoxConsoleWnd::updateAdditionsState (const QString &aVersion, 2749 bool aActive, 2750 bool aSeamless) 2616 2751 { 2617 2752 vmAutoresizeGuestAction->setEnabled (aActive); 2753 vmSeamlessAction->setEnabled (aSeamless); 2754 if (aSeamless && vmSeamlessAction->isOn()) 2755 vmSeamless (true); 2618 2756 2619 2757 /* Check the Guest Additions version and warn the user about possible -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFrameBuffer.cpp
r3611 r3674 267 267 return E_POINTER; 268 268 269 /// @todo 270 271 272 273 274 return S_OK; 275 } 276 277 STDMETHODIMP VBoxFrameBuffer::SetVisibleRegion (BYTE *aRectangles, ULONG aCount)269 /// @todo what and why? 270 271 NOREF(aCount); 272 NOREF(aCountCopied); 273 274 return S_OK; 275 } 276 277 STDMETHODIMP VBoxFrameBuffer::SetVisibleRegion (BYTE *aRectangles, ULONG aCount) 278 278 { 279 279 PRTRECT rects = (PRTRECT)aRectangles; … … 282 282 return E_POINTER; 283 283 284 /// @todo 285 286 NOREF(aCount); 284 if (!mView->isInSeamlessMode()) 285 return S_OK; 286 287 QRegion reg; 288 for (ULONG ind = 0; ind < aCount; ++ ind) 289 { 290 QRect rect; 291 rect.setLeft (rects->xLeft); 292 rect.setBottom (rects->yBottom); 293 rect.setRight (rects->xRight); 294 rect.setTop (rects->yTop); 295 reg += rect; 296 ++ rects; 297 } 298 QApplication::postEvent (mView, new VBoxSetRegionEvent (reg)); 287 299 288 300 return S_OK;
Note:
See TracChangeset
for help on using the changeset viewer.