Changeset 8219 in vbox
- Timestamp:
- Apr 21, 2008 11:47:41 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 29938
- Location:
- trunk/src/VBox/Frontends
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h
r8155 r8219 198 198 199 199 void setDesktopGeometry(int minWidth, int minHeight); 200 void sendInitialSizeHint(void);201 200 void maybeRestrictMinimumSize(); 202 201 … … 285 284 CGImageRef mVirtualBoxLogo; 286 285 #endif 287 QSize mLastSizeHint;288 286 QRect mDesktopGeometry; 289 287 }; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h
r8155 r8219 169 169 static const char* GUI_LastVMSelected; 170 170 static const char* GUI_InfoDlgState; 171 static const char* GUI_LastSizeHint;172 171 }; 173 172 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r8155 r8219 1075 1075 updateGeometry(); 1076 1076 1077 /* Remember the new size for sending an initial size hint1078 on next power up. */1079 if (mConsole.GetGuest().GetSupportsGraphics())1080 mLastSizeHint = QSize(re->width(), re->height());1081 1082 1077 /* make sure that all posted signals are processed */ 1083 1078 qApp->processEvents(); … … 2856 2851 } 2857 2852 } 2858 else if (mLastState == KMachineState_Starting)2859 {2860 /* Suggest an initial size. */2861 sendInitialSizeHint ();2862 }2863 2853 /* reuse the focus event handler to capture input */ 2864 2854 if (hasFocus()) 2865 2855 focusEvent (true /* aHasFocus */); 2866 2856 break; 2867 }2868 case KMachineState_Stopping:2869 {2870 if (mLastSizeHint.isValid())2871 {2872 CMachine cmachine = mConsole.GetMachine();2873 QString str = QString ("%1,%2")2874 .arg (mLastSizeHint.width())2875 .arg (mLastSizeHint.height());2876 cmachine.SetExtraData (VBoxDefs::GUI_LastSizeHint, str);2877 }2878 2857 } 2879 2858 default: … … 3558 3537 3559 3538 /** 3560 * We send an initial size hint to the VM on startup, based on the last3561 * resize event in the last session (if any).3562 */3563 void VBoxConsoleView::sendInitialSizeHint(void)3564 {3565 CMachine cmachine = mConsole.GetMachine();3566 QString str = cmachine.GetExtraData (VBoxDefs::GUI_LastSizeHint);3567 int w = 0, h = 0;3568 bool ok = true;3569 w = str.section (',', 0, 0).toInt (&ok);3570 if (ok)3571 h = str.section (',', 1, 1).toInt (&ok);3572 QRect screen = QApplication::desktop()->screenGeometry (this);3573 if (ok && w <= screen.width() && h <= screen.height())3574 {3575 LogFlowFunc (("Will suggest %d x %d\n", w, h));3576 mConsole.GetDisplay().SetVideoModeHint (w, h, 0, 0);3577 }3578 }3579 3580 /**3581 3539 * Sets the the minimum size restriction depending on the auto-resize feature 3582 3540 * state and the current rendering mode. -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxDefs.cpp
r8155 r8219 40 40 const char* VBoxDefs::GUI_LastVMSelected = "GUI/LastVMSelected"; 41 41 const char* VBoxDefs::GUI_InfoDlgState = "GUI/InfoDlgState"; 42 const char* VBoxDefs::GUI_LastSizeHint = "GUI/LastSizeHint"; -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleView.h
r8155 r8219 216 216 217 217 void setDesktopGeometry(int minWidth, int minHeight); 218 void sendInitialSizeHint(void);219 218 void maybeRestrictMinimumSize(); 220 219 … … 302 301 CGImageRef mVirtualBoxLogo; 303 302 #endif 304 QSize mLastSizeHint;305 303 QRect mDesktopGeometry; 306 304 }; -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxDefs.h
r8159 r8219 169 169 static const char* GUI_LastVMSelected; 170 170 static const char* GUI_InfoDlgState; 171 static const char* GUI_LastSizeHint;172 171 }; 173 172 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxDefs.cpp
r8155 r8219 40 40 const char* VBoxDefs::GUI_LastVMSelected = "GUI/LastVMSelected"; 41 41 const char* VBoxDefs::GUI_InfoDlgState = "GUI/InfoDlgState"; 42 const char* VBoxDefs::GUI_LastSizeHint = "GUI/LastSizeHint";
Note:
See TracChangeset
for help on using the changeset viewer.