Changeset 8902 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 16, 2008 3:32:30 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h
r8894 r8902 102 102 void setIgnoreMainwndResize (bool aYes) { mIgnoreMainwndResize = aYes; } 103 103 104 QRect getDesktopGeometry();104 QRect desktopGeometry(); 105 105 106 106 bool isAutoresizeGuestActive(); … … 199 199 private: 200 200 201 enum meDesktopGeo { 202 invalid = 0, fixed, automatic, any, unchanged 201 enum DesktopGeo 202 { 203 DesktopGeo_Invalid = 0, DesktopGeo_Fixed, 204 DesktopGeo_Automatic, DesktopGeo_Any, DesktopGeo_Unchanged 203 205 }; 204 void setDesktopGeometry(meDesktopGeo type, int width, int height); 205 void setDesktopGeoHint(int width, int height); 206 207 void setDesktopGeometry (DesktopGeo aGeo, int aWidth, int aHeight); 208 void setDesktopGeoHint (int aWidth, int aHeight); 206 209 void maybeRestrictMinimumSize(); 207 210 … … 290 293 CGImageRef mVirtualBoxLogo; 291 294 #endif 292 meDesktopGeo mDesktopGeoType;295 DesktopGeo mDesktopGeo; 293 296 QRect mDesktopGeometry; 294 297 QRect mLastSizeHint; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r8894 r8902 646 646 , mVirtualBoxLogo (NULL) 647 647 #endif 648 , mDesktopGeo Type(invalid)648 , mDesktopGeo (DesktopGeo_Invalid) 649 649 { 650 650 Assert (!mConsole.isNull() && … … 771 771 772 772 QString desktopGeometry = vboxGlobal().settings() 773 .publicProperty("GUI/MaxGuestResolution"); 774 if ( (QString::null == desktopGeometry) 775 || ("auto" == desktopGeometry) 776 ) 777 setDesktopGeometry(automatic, 0, 0); 778 else if ("any" == desktopGeometry) 779 setDesktopGeometry(any, 0, 0); 773 .publicProperty ("GUI/MaxGuestResolution"); 774 if ((desktopGeometry == QString::null) || 775 (desktopGeometry == "auto")) 776 setDesktopGeometry (DesktopGeo_Automatic, 0, 0); 777 else if (desktopGeometry == "any") 778 setDesktopGeometry (DesktopGeo_Any, 0, 0); 780 779 else 781 780 { 782 int width = desktopGeometry.section (',', 0, 0).toInt();783 int height = desktopGeometry.section (',', 1, 1).toInt();784 setDesktopGeometry (fixed, width, height);785 } 786 connect (QApplication::desktop(), SIGNAL (workAreaResized(int)),787 this, SLOT (doResizeDesktop(int)));781 int width = desktopGeometry.section (',', 0, 0).toInt(); 782 int height = desktopGeometry.section (',', 1, 1).toInt(); 783 setDesktopGeometry (DesktopGeo_Fixed, width, height); 784 } 785 connect (QApplication::desktop(), SIGNAL (workAreaResized (int)), 786 this, SLOT (doResizeDesktop (int))); 788 787 789 788 #if defined (VBOX_GUI_DEBUG) && defined (VBOX_GUI_FRAMEBUF_STAT) … … 2285 2284 * @returns the geometry. An empty rectangle means unrestricted. 2286 2285 */ 2287 QRect VBoxConsoleView:: getDesktopGeometry()2286 QRect VBoxConsoleView::desktopGeometry() 2288 2287 { 2289 2288 QRect rc; 2290 switch (mDesktopGeoType) 2291 { 2292 case fixed: 2293 case automatic: 2294 rc = QRect (0, 0, RT_MAX(mDesktopGeometry.width(), mLastSizeHint.width()), 2295 RT_MAX(mDesktopGeometry.height(), mLastSizeHint.height())); 2296 break; 2297 case any: 2298 rc = QRect (0, 0, 0, 0); 2299 break; 2300 default: 2301 AssertMsgFailed (("Bad geometry type %d\n", mDesktopGeoType)); 2289 switch (mDesktopGeo) 2290 { 2291 case DesktopGeo_Fixed: 2292 case DesktopGeo_Automatic: 2293 rc = QRect (0, 0, 2294 RT_MAX (mDesktopGeometry.width(), mLastSizeHint.width()), 2295 RT_MAX (mDesktopGeometry.height(), mLastSizeHint.height())); 2296 break; 2297 case DesktopGeo_Any: 2298 rc = QRect (0, 0, 0, 0); 2299 break; 2300 default: 2301 AssertMsgFailed (("Bad geometry type %d\n", mDesktopGeo)); 2302 2302 } 2303 2303 return rc; … … 3564 3564 3565 3565 /* Increase the desktop geometry if needed */ 3566 setDesktopGeoHint (sz.width(), sz.height());3566 setDesktopGeoHint (sz.width(), sz.height()); 3567 3567 3568 3568 if (mAutoresizeGuest) … … 3574 3574 { 3575 3575 /* If the desktop geometry is set automatically, this will update it. */ 3576 setDesktopGeometry (unchanged, 0, 0);3576 setDesktopGeometry (DesktopGeo_Unchanged, 0, 0); 3577 3577 } 3578 3578 … … 3583 3583 * way, or to the specified lower bound, whichever is greater. 3584 3584 * 3585 * @param fixed Are the parameters a fixed geometry size or a lower bound? 3586 * @param width The maximum width for the guest screen (fixed geometry) 3587 * or a lower bound for the maximum 3588 * @param height The maximum height for the guest screen (fixed geometry) 3585 * @param aWidth The maximum width for the guest screen (fixed geometry) or a 3586 * lower bound for the maximum 3587 * @param aHeight The maximum height for the guest screen (fixed geometry) 3589 3588 * or a lower bound for the maximum 3590 3589 */ 3591 void VBoxConsoleView::setDesktopGeoHint (int width, int height)3592 { 3593 LogFlowThisFunc (("width=%d, height=%d\n", width, height));3594 mLastSizeHint = QRect (0, 0, width, height);3590 void VBoxConsoleView::setDesktopGeoHint (int aWidth, int aHeight) 3591 { 3592 LogFlowThisFunc (("aWidth=%d, aHeight=%d\n", aWidth, aHeight)); 3593 mLastSizeHint = QRect (0, 0, aWidth, aHeight); 3595 3594 } 3596 3595 … … 3600 3599 * a hint from the host will always override these restrictions. 3601 3600 * 3602 * @param type Values: fixed - the guest has a fixed maximum framebuffer size3603 * automatic - we recalculate the maximum size ourselves3604 * any - any size is allowed3605 * @param widthThe maximum width for the guest screen or zero for no change3601 * @param aGeo Values: fixed - the guest has a fixed maximum framebuffer 3602 * size automatic - we recalculate the maximum size 3603 * ourselves any - any size is allowed 3604 * @param aWidth The maximum width for the guest screen or zero for no change 3606 3605 * (only used for fixed geometry) 3607 * @param heightThe maximum height for the guest screen or zero for no change3606 * @param aHeight The maximum height for the guest screen or zero for no change 3608 3607 * (only used for fixed geometry) 3609 3608 */ 3610 void VBoxConsoleView::setDesktopGeometry(meDesktopGeo type, int width, int height) 3611 { 3612 LogFlowThisFunc (("type = %s, width=%d, height=%d\n", 3613 (fixed == type ? "fixed" 3614 : (automatic == type ? "automatic" 3615 : (any == type ? "any" 3616 : (unchanged == type ? "unchanged" : "invalid") 3617 ) 3618 ) 3619 ), width, height 3620 )); 3621 Assert((type != unchanged) || (mDesktopGeoType != invalid)); 3622 if (unchanged == type) 3623 type = mDesktopGeoType; 3624 switch (type) 3625 { 3626 case fixed: 3627 mDesktopGeoType = fixed; 3628 if ((0 != width ) && (0 != height)) 3629 mDesktopGeometry = QRect (0, 0, width, height); 3630 setDesktopGeoHint (0, 0); 3631 break; 3632 case automatic: 3633 { 3634 mDesktopGeoType = automatic; 3635 QRect desktop = QApplication::desktop()->screenGeometry (this); 3636 mDesktopGeometry = QRect(0, 0, desktop.width() - 100, desktop.height() - 100); 3637 LogFlowThisFunc(("Setting %d, %d\n", desktop.width() - 100, desktop.height() - 100)); 3638 setDesktopGeoHint (0, 0); 3639 break; 3640 } 3641 case any: 3642 mDesktopGeoType = any; 3643 mDesktopGeometry = QRect (0, 0, 0, 0); 3644 break; 3645 default: 3646 AssertMsgFailed(("Invalid desktop geometry type %d\n", type)); 3647 mDesktopGeoType = invalid; 3609 void VBoxConsoleView::setDesktopGeometry (DesktopGeo aGeo, int aWidth, int aHeight) 3610 { 3611 LogFlowThisFunc (("aGeo=%s, aWidth=%d, aHeight=%d\n", 3612 (aGeo == DesktopGeo_Fixed ? "Fixed" : 3613 aGeo == DesktopGeo_Automatic ? "Automatic" : 3614 aGeo == DesktopGeo_Any ? "Any" : 3615 aGeo == DesktopGeo_Unchanged ? "Unchanged" : "Invalid"), 3616 aWidth, aHeight)); 3617 Assert ((aGeo != DesktopGeo_Unchanged) || (mDesktopGeo != DesktopGeo_Invalid)); 3618 if (DesktopGeo_Unchanged == aGeo) 3619 aGeo = mDesktopGeo; 3620 switch (aGeo) 3621 { 3622 case DesktopGeo_Fixed: 3623 mDesktopGeo = DesktopGeo_Fixed; 3624 if (aWidth != 0 && aHeight != 0) 3625 mDesktopGeometry = QRect (0, 0, aWidth, aHeight); 3626 setDesktopGeoHint (0, 0); 3627 break; 3628 case DesktopGeo_Automatic: 3629 { 3630 mDesktopGeo = DesktopGeo_Automatic; 3631 QRect desktop = QApplication::desktop()->screenGeometry (this); 3632 mDesktopGeometry = QRect (0, 0, desktop.width() - 100, desktop.height() - 100); 3633 LogFlowThisFunc (("Setting %d, %d\n", desktop.width() - 100, desktop.height() - 100)); 3634 setDesktopGeoHint (0, 0); 3635 break; 3636 } 3637 case DesktopGeo_Any: 3638 mDesktopGeo = DesktopGeo_Any; 3639 mDesktopGeometry = QRect (0, 0, 0, 0); 3640 break; 3641 default: 3642 AssertMsgFailed(("Invalid desktop geometry type %d\n", aGeo)); 3643 mDesktopGeo = DesktopGeo_Invalid; 3648 3644 } 3649 3645 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFrameBuffer.cpp
r8888 r8902 205 205 return E_POINTER; 206 206 *aSupported = TRUE; 207 QRect screen = mView-> getDesktopGeometry();207 QRect screen = mView->desktopGeometry(); 208 208 if ( (screen.width() != 0) 209 209 && (aWidth > (ULONG) screen.width())
Note:
See TracChangeset
for help on using the changeset viewer.