Changeset 8902 in vbox for trunk/src/VBox/Frontends/VirtualBox4
- Timestamp:
- May 16, 2008 3:32:30 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleView.h
r8888 r8902 99 99 void setIgnoreMainwndResize (bool aYes) { mIgnoreMainwndResize = aYes; } 100 100 101 QRect getDesktopGeometry();101 QRect desktopGeometry(); 102 102 103 103 /* todo: This are some support functions for the qt4 port. Maybe we get rid … … 215 215 private: 216 216 217 enum meDesktopGeo { 218 invalid = 0, fixed, automatic, any, unchanged 217 enum DesktopGeo 218 { 219 DesktopGeo_Invalid = 0, DesktopGeo_Fixed, 220 DesktopGeo_Automatic, DesktopGeo_Any, DesktopGeo_Unchanged 219 221 }; 220 void setDesktopGeometry(meDesktopGeo type, int width, int height); 221 void setDesktopGeoHint(int width, int height); 222 223 void setDesktopGeometry (DesktopGeo aGeo, int aWidth, int aHeight); 224 void setDesktopGeoHint (int aWidth, int aHeight); 222 225 void maybeRestrictMinimumSize(); 223 226 … … 305 308 CGImageRef mVirtualBoxLogo; 306 309 #endif 307 meDesktopGeo mDesktopGeoType;310 DesktopGeo mDesktopGeo; 308 311 QRect mDesktopGeometry; 309 312 QRect mLastSizeHint; -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleView.cpp
r8893 r8902 667 667 , mVirtualBoxLogo (NULL) 668 668 #endif 669 , mDesktopGeo Type(invalid)669 , mDesktopGeo (DesktopGeo_Invalid) 670 670 { 671 671 Assert (!mConsole.isNull() && … … 800 800 801 801 QString desktopGeometry = vboxGlobal().settings() 802 .publicProperty("GUI/MaxGuestResolution"); 803 if ( (QString::null == desktopGeometry) 804 || ("auto" == desktopGeometry) 805 ) 806 setDesktopGeometry(automatic, 0, 0); 807 else if ("any" == desktopGeometry) 808 setDesktopGeometry(any, 0, 0); 802 .publicProperty ("GUI/MaxGuestResolution"); 803 if ((desktopGeometry == QString::null) || 804 (desktopGeometry == "auto")) 805 setDesktopGeometry (DesktopGeo_Automatic, 0, 0); 806 else if (desktopGeometry == "any") 807 setDesktopGeometry (DesktopGeo_Any, 0, 0); 809 808 else 810 809 { 811 int width = desktopGeometry.section (',', 0, 0).toInt();812 int height = desktopGeometry.section (',', 1, 1).toInt();813 setDesktopGeometry (fixed, width, height);814 } 815 connect (QApplication::desktop(), SIGNAL (workAreaResized(int)),816 this, SLOT (doResizeDesktop(int)));810 int width = desktopGeometry.section (',', 0, 0).toInt(); 811 int height = desktopGeometry.section (',', 1, 1).toInt(); 812 setDesktopGeometry (DesktopGeo_Fixed, width, height); 813 } 814 connect (QApplication::desktop(), SIGNAL (workAreaResized (int)), 815 this, SLOT (doResizeDesktop (int))); 817 816 818 817 #if defined (VBOX_GUI_DEBUG) && defined (VBOX_GUI_FRAMEBUF_STAT) … … 2316 2315 * @returns the geometry. An empty rectangle means unrestricted. 2317 2316 */ 2318 QRect VBoxConsoleView:: getDesktopGeometry()2317 QRect VBoxConsoleView::desktopGeometry() 2319 2318 { 2320 2319 QRect rc; 2321 switch (mDesktopGeoType) 2322 { 2323 case fixed: 2324 case automatic: 2325 rc = QRect (0, 0, RT_MAX(mDesktopGeometry.width(), mLastSizeHint.width()), 2326 RT_MAX(mDesktopGeometry.height(), mLastSizeHint.height())); 2327 break; 2328 case any: 2329 rc = QRect (0, 0, 0, 0); 2330 break; 2331 default: 2332 AssertMsgFailed (("Bad geometry type %d\n", mDesktopGeoType)); 2320 switch (mDesktopGeo) 2321 { 2322 case DesktopGeo_Fixed: 2323 case DesktopGeo_Automatic: 2324 rc = QRect (0, 0, 2325 RT_MAX (mDesktopGeometry.width(), mLastSizeHint.width()), 2326 RT_MAX (mDesktopGeometry.height(), mLastSizeHint.height())); 2327 break; 2328 case DesktopGeo_Any: 2329 rc = QRect (0, 0, 0, 0); 2330 break; 2331 default: 2332 AssertMsgFailed (("Bad geometry type %d\n", mDesktopGeo)); 2333 2333 } 2334 2334 return rc; … … 3582 3582 3583 3583 /* Increase the desktop geometry if needed */ 3584 setDesktopGeoHint (sz.width(), sz.height());3584 setDesktopGeoHint (sz.width(), sz.height()); 3585 3585 3586 3586 if (mAutoresizeGuest) … … 3592 3592 { 3593 3593 /* If the desktop geometry is set automatically, this will update it. */ 3594 setDesktopGeometry (unchanged, 0, 0);3594 setDesktopGeometry (DesktopGeo_Unchanged, 0, 0); 3595 3595 } 3596 3596 … … 3601 3601 * way, or to the specified lower bound, whichever is greater. 3602 3602 * 3603 * @param fixed Are the parameters a fixed geometry size or a lower bound? 3604 * @param width The maximum width for the guest screen (fixed geometry) 3605 * or a lower bound for the maximum 3606 * @param height The maximum height for the guest screen (fixed geometry) 3603 * @param aWidth The maximum width for the guest screen (fixed geometry) or a 3604 * lower bound for the maximum 3605 * @param aHeight The maximum height for the guest screen (fixed geometry) 3607 3606 * or a lower bound for the maximum 3608 3607 */ 3609 void VBoxConsoleView::setDesktopGeoHint (int width, int height)3610 { 3611 LogFlowThisFunc (("width=%d, height=%d\n", width, height));3612 mLastSizeHint = QRect (0, 0, width, height);3608 void VBoxConsoleView::setDesktopGeoHint (int aWidth, int aHeight) 3609 { 3610 LogFlowThisFunc (("aWidth=%d, aHeight=%d\n", aWidth, aHeight)); 3611 mLastSizeHint = QRect (0, 0, aWidth, aHeight); 3613 3612 } 3614 3613 … … 3618 3617 * a hint from the host will always override these restrictions. 3619 3618 * 3620 * @param type Values: fixed - the guest has a fixed maximum framebuffer size3621 * automatic - we recalculate the maximum size ourselves3622 * any - any size is allowed3623 * @param widthThe maximum width for the guest screen or zero for no change3619 * @param aGeo Values: fixed - the guest has a fixed maximum framebuffer 3620 * size automatic - we recalculate the maximum size 3621 * ourselves any - any size is allowed 3622 * @param aWidth The maximum width for the guest screen or zero for no change 3624 3623 * (only used for fixed geometry) 3625 * @param heightThe maximum height for the guest screen or zero for no change3624 * @param aHeight The maximum height for the guest screen or zero for no change 3626 3625 * (only used for fixed geometry) 3627 3626 */ 3628 void VBoxConsoleView::setDesktopGeometry(meDesktopGeo type, int width, int height) 3629 { 3630 LogFlowThisFunc (("type = %s, width=%d, height=%d\n", 3631 (fixed == type ? "fixed" 3632 : (automatic == type ? "automatic" 3633 : (any == type ? "any" 3634 : (unchanged == type ? "unchanged" : "invalid") 3635 ) 3636 ) 3637 ), width, height 3638 )); 3639 Assert((type != unchanged) || (mDesktopGeoType != invalid)); 3640 if (unchanged == type) 3641 type = mDesktopGeoType; 3642 switch (type) 3643 { 3644 case fixed: 3645 mDesktopGeoType = fixed; 3646 if ((0 != width ) && (0 != height)) 3647 mDesktopGeometry = QRect (0, 0, width, height); 3648 setDesktopGeoHint (0, 0); 3649 break; 3650 case automatic: 3651 { 3652 mDesktopGeoType = automatic; 3653 QRect desktop = QApplication::desktop()->screenGeometry (this); 3654 mDesktopGeometry = QRect(0, 0, desktop.width() - 100, desktop.height() - 100); 3655 LogFlowThisFunc(("Setting %d, %d\n", desktop.width() - 100, desktop.height() - 100)); 3656 setDesktopGeoHint (0, 0); 3657 break; 3658 } 3659 case any: 3660 mDesktopGeoType = any; 3661 mDesktopGeometry = QRect (0, 0, 0, 0); 3662 break; 3663 default: 3664 AssertMsgFailed(("Invalid desktop geometry type %d\n", type)); 3665 mDesktopGeoType = invalid; 3627 void VBoxConsoleView::setDesktopGeometry (DesktopGeo aGeo, int aWidth, int aHeight) 3628 { 3629 LogFlowThisFunc (("aGeo=%s, aWidth=%d, aHeight=%d\n", 3630 (aGeo == DesktopGeo_Fixed ? "Fixed" : 3631 aGeo == DesktopGeo_Automatic ? "Automatic" : 3632 aGeo == DesktopGeo_Any ? "Any" : 3633 aGeo == DesktopGeo_Unchanged ? "Unchanged" : "Invalid"), 3634 aWidth, aHeight)); 3635 Assert ((aGeo != DesktopGeo_Unchanged) || (mDesktopGeo != DesktopGeo_Invalid)); 3636 if (DesktopGeo_Unchanged == aGeo) 3637 aGeo = mDesktopGeo; 3638 switch (aGeo) 3639 { 3640 case DesktopGeo_Fixed: 3641 mDesktopGeo = DesktopGeo_Fixed; 3642 if (aWidth != 0 && aHeight != 0) 3643 mDesktopGeometry = QRect (0, 0, aWidth, aHeight); 3644 setDesktopGeoHint (0, 0); 3645 break; 3646 case DesktopGeo_Automatic: 3647 { 3648 mDesktopGeo = DesktopGeo_Automatic; 3649 QRect desktop = QApplication::desktop()->screenGeometry (this); 3650 mDesktopGeometry = QRect (0, 0, desktop.width() - 100, desktop.height() - 100); 3651 LogFlowThisFunc (("Setting %d, %d\n", desktop.width() - 100, desktop.height() - 100)); 3652 setDesktopGeoHint (0, 0); 3653 break; 3654 } 3655 case DesktopGeo_Any: 3656 mDesktopGeo = DesktopGeo_Any; 3657 mDesktopGeometry = QRect (0, 0, 0, 0); 3658 break; 3659 default: 3660 AssertMsgFailed(("Invalid desktop geometry type %d\n", aGeo)); 3661 mDesktopGeo = DesktopGeo_Invalid; 3666 3662 } 3667 3663 } -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxFrameBuffer.cpp
r8888 r8902 206 206 return E_POINTER; 207 207 *aSupported = TRUE; 208 QRect screen = mView-> getDesktopGeometry();208 QRect screen = mView->desktopGeometry(); 209 209 if ( (screen.width() != 0) 210 210 && (aWidth > (ULONG) screen.width())
Note:
See TracChangeset
for help on using the changeset viewer.