Changeset 38947 in vbox for trunk/src/VBox
- Timestamp:
- Oct 5, 2011 8:22:07 PM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r38505 r38947 20 20 /* Global includes */ 21 21 #include <QDesktopWidget> 22 #include <QMainWindow> 22 23 #include <QTimer> 23 24 #include <QPainter> … … 145 146 } 146 147 148 void UIMachineView::sltPerformGuestResize(const QSize &toSize) 149 { 150 /* Get machine window: */ 151 QMainWindow *pMachineWindow = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ? 152 qobject_cast<QMainWindow*>(machineWindowWrapper()->machineWindow()) : 0; 153 154 /* If this slot is invoked directly then use the passed size otherwise get 155 * the available size for the guest display. We assume here that centralWidget() 156 * contains this view only and gives it all available space: */ 157 QSize newSize(toSize.isValid() ? toSize : pMachineWindow ? pMachineWindow->centralWidget()->size() : QSize()); 158 AssertMsg(newSize.isValid(), ("Size should be valid!\n")); 159 160 /* Do not send the same hints as we already have: */ 161 if ((newSize.width() == storedConsoleSize().width()) && (newSize.height() == storedConsoleSize().height())) 162 return; 163 164 /* We only actually send the hint if either an explicit new size was given 165 * (e.g. if the request was triggered directly by a console resize event) or 166 * if no explicit size was specified but a resize is flagged as being needed 167 * (e.g. the autoresize was just enabled and the console was resized while it was disabled). */ 168 if (toSize.isValid() || m_fShouldWeDoResize) 169 { 170 /* Remember the new size: */ 171 storeConsoleSize(newSize.width(), newSize.height()); 172 173 /* Send new size-hint to the guest: */ 174 session().GetConsole().GetDisplay().SetVideoModeHint(newSize.width(), newSize.height(), 0, screenId()); 175 } 176 177 /* We had requested resize now, rejecting other accident requests: */ 178 m_fShouldWeDoResize = false; 179 } 180 147 181 void UIMachineView::sltMachineStateChanged() 148 182 { … … 215 249 , m_desktopGeometryType(DesktopGeo_Invalid) 216 250 , m_bIsMachineWindowResizeIgnored(false) 251 , m_fShouldWeDoResize(false) 217 252 #ifdef VBOX_WITH_VIDEOHWACCEL 218 253 , m_fAccelerate2DVideo(bAccelerate2DVideo) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r35247 r38947 73 73 74 74 protected slots: 75 76 /* Slot to perform guest resize: */ 77 void sltPerformGuestResize(const QSize &aSize = QSize()); 75 78 76 79 /* Console callback handlers: */ … … 166 169 #endif 167 170 168 /* Pr ivatemembers: */171 /* Protected members: */ 169 172 UIMachineWindow *m_pMachineWindow; 170 173 ulong m_uScreenId; … … 177 180 178 181 bool m_bIsMachineWindowResizeIgnored : 1; 182 bool m_fShouldWeDoResize : 1; 179 183 #ifdef VBOX_WITH_VIDEOHWACCEL 180 184 bool m_fAccelerate2DVideo : 1; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp
r38348 r38947 52 52 ) 53 53 , m_bIsGuestAutoresizeEnabled(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->isChecked()) 54 , m_fShouldWeDoResize(false)55 54 , m_pSyncBlocker(0) 56 55 { … … 89 88 } 90 89 91 void UIMachineViewFullscreen::sltPerformGuestResize(const QSize &toSize)92 {93 if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())94 {95 /* Get machine window: */96 QMainWindow *pMachineWindow = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ?97 qobject_cast<QMainWindow*>(machineWindowWrapper()->machineWindow()) : 0;98 99 /* If this slot is invoked directly then use the passed size otherwise get100 * the available size for the guest display. We assume here that centralWidget()101 * contains this view only and gives it all available space: */102 QSize newSize(toSize.isValid() ? toSize : pMachineWindow ? pMachineWindow->centralWidget()->size() : QSize());103 AssertMsg(newSize.isValid(), ("Size should be valid!\n"));104 105 /* Do not send the same hints as we already have: */106 if ((newSize.width() == storedConsoleSize().width()) && (newSize.height() == storedConsoleSize().height()))107 return;108 109 /* We only actually send the hint if either an explicit new size was given110 * (e.g. if the request was triggered directly by a console resize event) or111 * if no explicit size was specified but a resize is flagged as being needed112 * (e.g. the autoresize was just enabled and the console was resized while it was disabled). */113 if (toSize.isValid() || m_fShouldWeDoResize)114 {115 /* Remember the new size: */116 storeConsoleSize(newSize.width(), newSize.height());117 118 /* Send new size-hint to the guest: */119 session().GetConsole().GetDisplay().SetVideoModeHint(newSize.width(), newSize.height(), 0, screenId());120 }121 122 /* We had requested resize now, rejecting other accident requests: */123 m_fShouldWeDoResize = false;124 }125 }126 127 90 void UIMachineViewFullscreen::sltAdditionsStateChanged() 128 91 { … … 130 93 maybeRestrictMinimumSize(); 131 94 132 /* Check if we should resize guest to fullscreen, all the 133 * required features will be tested in sltPerformGuestResize(...): */ 95 /* Check if we should resize guest to fullscreen */ 134 96 if ((int)frameBuffer()->width() != workingArea().size().width() || 135 97 (int)frameBuffer()->height() != workingArea().size().height()) 136 sltPerformGuestResize(workingArea().size()); 98 if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics()) 99 sltPerformGuestResize(workingArea().size()); 137 100 } 138 101 … … 321 284 maybeRestrictMinimumSize(); 322 285 323 sltPerformGuestResize(); 286 if (uisession()->isGuestSupportsGraphics()) 287 sltPerformGuestResize(); 324 288 } 325 289 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h
r30544 r38947 41 41 private slots: 42 42 43 /* Slot to perform guest resize: */44 void sltPerformGuestResize(const QSize &aSize = QSize());45 46 43 /* Console callback handlers: */ 47 44 void sltAdditionsStateChanged(); … … 81 78 /* Private variables: */ 82 79 bool m_bIsGuestAutoresizeEnabled : 1; 83 bool m_fShouldWeDoResize : 1;84 80 UIMachineViewBlocker *m_pSyncBlocker; 85 81 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp
r38348 r38947 48 48 ) 49 49 , m_bIsGuestAutoresizeEnabled(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->isChecked()) 50 , m_fShouldWeDoResize(false)51 50 { 52 51 /* Load machine view settings: */ … … 83 82 /* Cleanup frame buffer: */ 84 83 cleanupFrameBuffer(); 85 }86 87 void UIMachineViewNormal::sltPerformGuestResize(const QSize &toSize)88 {89 if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())90 {91 /* Get machine window: */92 QMainWindow *pMachineWindow = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ?93 qobject_cast<QMainWindow*>(machineWindowWrapper()->machineWindow()) : 0;94 95 /* If this slot is invoked directly then use the passed size otherwise get96 * the available size for the guest display. We assume here that centralWidget()97 * contains this view only and gives it all available space: */98 QSize newSize(toSize.isValid() ? toSize : pMachineWindow ? pMachineWindow->centralWidget()->size() : QSize());99 AssertMsg(newSize.isValid(), ("Size should be valid!\n"));100 101 /* Do not send the same hints as we already have: */102 if ((newSize.width() == storedConsoleSize().width()) && (newSize.height() == storedConsoleSize().height()))103 return;104 105 /* We only actually send the hint if either an explicit new size was given106 * (e.g. if the request was triggered directly by a console resize event) or107 * if no explicit size was specified but a resize is flagged as being needed108 * (e.g. the autoresize was just enabled and the console was resized while it was disabled). */109 if (toSize.isValid() || m_fShouldWeDoResize)110 {111 /* Remember the new size: */112 storeConsoleSize(newSize.width(), newSize.height());113 114 /* Send new size-hint to the guest: */115 session().GetConsole().GetDisplay().SetVideoModeHint(newSize.width(), newSize.height(), 0, screenId());116 }117 118 /* We had requested resize now, rejecting other accident requests: */119 m_fShouldWeDoResize = false;120 }121 84 } 122 85 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h
r30547 r38947 40 40 41 41 private slots: 42 43 /* Slot to perform guest resize: */44 void sltPerformGuestResize(const QSize &size = QSize());45 42 46 43 /* Console callback handlers: */ … … 87 84 /* Private members: */ 88 85 bool m_bIsGuestAutoresizeEnabled : 1; 89 bool m_fShouldWeDoResize : 1;90 86 91 87 /* Friend classes: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
r32174 r38947 50 50 #endif 51 51 ) 52 , m_fShouldWeDoResize(false)53 52 , m_pSyncBlocker(0) 54 53 { … … 89 88 /* Cleanup frame buffer: */ 90 89 cleanupFrameBuffer(); 91 }92 93 void UIMachineViewSeamless::sltPerformGuestResize(const QSize &toSize)94 {95 if (uisession()->isGuestSupportsGraphics())96 {97 /* Get machine window: */98 QMainWindow *pMachineWindow = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ?99 qobject_cast<QMainWindow*>(machineWindowWrapper()->machineWindow()) : 0;100 101 /* If this slot is invoked directly then use the passed size otherwise get102 * the available size for the guest display. We assume here that centralWidget()103 * contains this view only and gives it all available space: */104 QSize newSize(toSize.isValid() ? toSize : pMachineWindow ? pMachineWindow->centralWidget()->size() : QSize());105 AssertMsg(newSize.isValid(), ("Size should be valid!\n"));106 107 /* Do not send the same hints as we already have: */108 if ((newSize.width() == storedConsoleSize().width()) && (newSize.height() == storedConsoleSize().height()))109 return;110 111 /* We only actually send the hint if either an explicit new size was given112 * (e.g. if the request was triggered directly by a console resize event) or113 * if no explicit size was specified but a resize is flagged as being needed114 * (e.g. the autoresize was just enabled and the console was resized while it was disabled). */115 if (toSize.isValid() || m_fShouldWeDoResize)116 {117 /* Remember the new size: */118 storeConsoleSize(newSize.width(), newSize.height());119 120 /* Send new size-hint to the guest: */121 session().GetConsole().GetDisplay().SetVideoModeHint(newSize.width(), newSize.height(), 0, screenId());122 }123 124 /* We had requested resize now, rejecting other accident requests: */125 m_fShouldWeDoResize = false;126 }127 90 } 128 91 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h
r30545 r38947 46 46 private slots: 47 47 48 /* Slot to perform guest resize: */49 void sltPerformGuestResize(const QSize &aSize = QSize());50 51 48 /* Console callback handlers: */ 52 49 void sltAdditionsStateChanged(); … … 82 79 83 80 /* Private variables: */ 84 bool m_fShouldWeDoResize : 1;85 81 QRegion m_lastVisibleRegion; 86 82 UIMachineViewBlocker *m_pSyncBlocker;
Note:
See TracChangeset
for help on using the changeset viewer.