- Timestamp:
- May 16, 2008 3:32:30 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends
- Files:
-
- 6 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()) -
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.