Changeset 79403 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 28, 2019 9:46:46 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 131644
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp
r78995 r79403 179 179 void UIMachineViewNormal::adjustGuestScreenSize() 180 180 { 181 /* Should we adjust guest-screen size? Logging paranoia is required here to reveal the truth. */182 181 LogRel(("GUI: UIMachineViewNormal::adjustGuestScreenSize: Adjust guest-screen size if necessary\n")); 183 bool fAdjust = false; 184 185 /* Step 1: Is the guest-screen of another size than necessary? */ 186 if (!fAdjust) 187 { 188 /* Acquire frame-buffer size: */ 189 QSize frameBufferSize(frameBuffer()->width(), frameBuffer()->height()); 190 /* Take the scale-factor(s) into account: */ 191 frameBufferSize = scaledForward(frameBufferSize); 192 193 /* Acquire central-widget size: */ 194 const QSize centralWidgetSize = machineWindow()->centralWidget()->size(); 195 196 if (frameBufferSize != centralWidgetSize) 197 { 198 LogRel2(("GUI: UIMachineViewNormal::adjustGuestScreenSize: Guest-screen is of another size than necessary, adjustment is required.\n")); 199 fAdjust = true; 200 } 201 } 202 203 /* Step 2: Is guest-additions supports graphics? */ 204 if (fAdjust) 205 { 206 if (!uisession()->isGuestSupportsGraphics()) 207 { 208 LogRel2(("GUI: UIMachineViewNormal::adjustGuestScreenSize: Guest-additions are not supporting graphics, adjustment is omitted.\n")); 209 fAdjust = false; 210 } 211 } 212 /* Step 3: Is guest-screen visible? */ 213 if (fAdjust) 214 { 215 if (!uisession()->isScreenVisible(screenId())) 216 { 217 LogRel2(("GUI: UIMachineViewNormal::adjustGuestScreenSize: Guest-screen is not visible, adjustment is omitted.\n")); 218 fAdjust = false; 219 } 220 } 221 /* Step 4: Is guest-screen auto-resize enabled? */ 222 if (fAdjust) 223 { 224 if (!m_bIsGuestAutoresizeEnabled) 225 { 226 LogRel2(("GUI: UIMachineViewNormal::adjustGuestScreenSize: Guest-screen auto-resize is disabled, adjustment is omitted.\n")); 227 fAdjust = false; 228 } 229 } 230 /* Step 5: Is another visual representation mode requested? */ 231 if (fAdjust) 232 { 233 if (uisession()->requestedVisualState() == UIVisualStateType_Seamless) // Seamless only for now. 234 { 235 LogRel2(("GUI: UIMachineViewNormal::adjustGuestScreenSize: Seamless mode is requested, adjustment is omitted.\n")); 236 fAdjust = false; 237 } 238 } 239 240 /* Final step: Adjust if requested/allowed. */ 241 if (fAdjust) 242 { 182 183 /* Get last monitor size set, if any: */ 184 BOOL fEnabled, fChangeOrigin; 185 LONG iOriginX, iOriginY; 186 ULONG uWidth, uHeight, uBitsPerPixel; 187 display().GetVideoModeHint(screenId(), fEnabled, fChangeOrigin, 188 iOriginX, iOriginY, uWidth, uHeight, uBitsPerPixel); 189 190 /* Acquire effective frame-buffer size otherwise: */ 191 if (uWidth == 0 || uHeight == 0) 192 { 193 uWidth = frameBuffer()->width(); 194 uHeight = frameBuffer()->height(); 195 } 196 197 /* Compose frame-buffer size: */ 198 QSize frameBufferSize(uWidth, uHeight); 199 /* Take the scale-factor(s) into account: */ 200 frameBufferSize = scaledForward(frameBufferSize); 201 202 /* Adjust guest-screen size if the last size hint is too big for the screen: */ 203 const QSize maxGuestSize = calculateMaxGuestSize(); 204 if ( maxGuestSize.width() < frameBufferSize.width() 205 || maxGuestSize.height() < frameBufferSize.height()) 243 206 sltPerformGuestResize(machineWindow()->centralWidget()->size()); 244 }245 207 } 246 208
Note:
See TracChangeset
for help on using the changeset viewer.