Changeset 52956 in vbox
- Timestamp:
- Oct 6, 2014 3:51:22 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxGuestLib.h
r52893 r52956 488 488 "/VideoModeHint" 489 489 490 VBGLR3DECL(int) VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay, bool fAck); 491 VBGLR3DECL(int) VbglR3GetDisplayChangeRequestEx(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, 492 uint32_t *piDisplay, uint32_t *pcOriginX, uint32_t *pcOriginY, 493 bool *pfEnabled, bool fAck); 490 /** The folder for saving video mode hints to between sessions. */ 491 #define VBGLR3HOSTDISPSAVEDMODEPATH "/var/lib/VBoxGuestAdditions" 492 /** The path to the file for saving video mode hints to between sessions. */ 493 #define VBGLR3HOSTDISPSAVEDMODE VBGLR3HOSTDISPSAVEDMODEPATH \ 494 "/SavedVideoModes" 495 496 VBGLR3DECL(int) VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, 497 uint32_t *pcBits, 498 uint32_t *piDisplay, 499 uint32_t *pdx, uint32_t *pdy, 500 bool *pfEnabled, 501 bool *pfChangeOrigin, 502 bool fAck); 494 503 VBGLR3DECL(bool) VbglR3HostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits); 495 504 VBGLR3DECL(int) VbglR3VideoModeGetHighestSavedScreen(unsigned *pcScreen); -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp
r52210 r52956 140 140 if (RT_SUCCESS(rc)) 141 141 rc = pReq->header.rc; 142 return rc;143 }144 /**145 * Query the last display change request sent from the host to the guest.146 *147 * @returns iprt status value148 * @param pcx Where to store the horizontal pixel resolution149 * requested (a value of zero means do not change).150 * @param pcy Where to store the vertical pixel resolution151 * requested (a value of zero means do not change).152 * @param pcBits Where to store the bits per pixel requested (a value153 * of zero means do not change).154 * @param iDisplay Where to store the display number the request was for155 * - 0 for the primary display, 1 for the first156 * secondary display, etc.157 * @param fAck whether or not to acknowledge the newest request sent by158 * the host. If this is set, the function will return the159 * most recent host request, otherwise it will return the160 * last request to be acknowledged.161 *162 * @param pcOriginX New horizontal position of the secondary monitor.163 * @param pcOriginY New vertical position of the secondary monitor.164 * param pfEnabled Secondary monitor is enabled or not.165 *166 */167 VBGLR3DECL(int) VbglR3GetDisplayChangeRequestEx(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits,168 uint32_t *piDisplay, uint32_t *pcOriginX, uint32_t *pcOriginY,169 bool *pfEnabled, bool fAck)170 {171 VMMDevDisplayChangeRequestEx Req;172 int rc = VINF_SUCCESS;173 AssertPtrReturn(pcx, VERR_INVALID_PARAMETER);174 AssertPtrReturn(pcy, VERR_INVALID_PARAMETER);175 AssertPtrReturn(pcBits, VERR_INVALID_PARAMETER);176 AssertPtrReturn(pcOriginX, VERR_INVALID_PARAMETER);177 AssertPtrReturn(pcOriginY, VERR_INVALID_PARAMETER);178 AssertPtrReturn(piDisplay, VERR_INVALID_PARAMETER);179 AssertPtrReturn(pfEnabled, VERR_INVALID_PARAMETER);180 RT_ZERO(Req);181 rc = vmmdevInitRequest(&Req.header, VMMDevReq_GetDisplayChangeRequestEx);182 if (RT_FAILURE(rc))183 {184 LogRelFlowFunc(("DisplayChangeRequest Extended not supported. Can't Init the Req.\n"));185 return rc;186 }187 188 if (fAck)189 Req.eventAck = VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST;190 rc = vbglR3GRPerform(&Req.header);191 if (RT_SUCCESS(rc))192 rc = Req.header.rc;193 if (RT_SUCCESS(rc))194 {195 *pcx = Req.xres;196 *pcy = Req.yres;197 *pcBits = Req.bpp;198 *piDisplay = Req.display;199 *pcOriginX = Req.cxOrigin;200 *pcOriginY = Req.cyOrigin;201 *pfEnabled = Req.fEnabled;202 LogRel(("VbglR3GetDisplayChangeRequestEx: pcx=%d pcy=%d display=%d orgX=%d orgY=%d and Enabled=%d\n",203 *pcx, *pcy, *piDisplay, *pcOriginX, *pcOriginY, *pfEnabled));204 }205 142 return rc; 206 143 } … … 225 162 * 226 163 */ 227 VBGLR3DECL(int) VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay, bool fAck) 164 static int getDisplayChangeRequest2(uint32_t *pcx, uint32_t *pcy, 165 uint32_t *pcBits, uint32_t *piDisplay, 166 bool fAck) 228 167 { 229 168 VMMDevDisplayChangeRequest2 Req; … … 246 185 *pcBits = Req.bpp; 247 186 *piDisplay = Req.display; 187 } 188 return rc; 189 } 190 191 192 /** 193 * Query the last display change request sent from the host to the guest. 194 * 195 * @returns iprt status value 196 * @param pcx Where to store the horizontal pixel resolution 197 * requested (a value of zero means do not change). 198 * @param pcy Where to store the vertical pixel resolution 199 * requested (a value of zero means do not change). 200 * @param pcBits Where to store the bits per pixel requested (a value 201 * of zero means do not change). 202 * @param piDisplay Where to store the display number the request was for 203 * - 0 for the primary display, 1 for the first 204 * secondary display, etc. 205 * @param fAck whether or not to acknowledge the newest request sent by 206 * the host. If this is set, the function will return the 207 * most recent host request, otherwise it will return the 208 * last request to be acknowledged. 209 * 210 * @param pdx New horizontal position of the secondary monitor. 211 * Optional. 212 * @param pdy New vertical position of the secondary monitor. 213 * Optional. 214 * param pfEnabled Secondary monitor is enabled or not. 215 * Optional. 216 * param pfChangeOrigin Whether the mode hint retrieved included information 217 * about origin/display offset inside the frame-buffer. 218 * Optional. 219 * 220 */ 221 VBGLR3DECL(int) VbglR3GetDisplayChangeRequest(uint32_t *pcx, uint32_t *pcy, 222 uint32_t *pcBits, 223 uint32_t *piDisplay, 224 uint32_t *pdx, uint32_t *pdy, 225 bool *pfEnabled, 226 bool *pfChangeOrigin, 227 bool fAck) 228 { 229 VMMDevDisplayChangeRequestEx Req; 230 int rc = VINF_SUCCESS; 231 AssertPtrReturn(pcx, VERR_INVALID_PARAMETER); 232 AssertPtrReturn(pcy, VERR_INVALID_PARAMETER); 233 AssertPtrReturn(pcBits, VERR_INVALID_PARAMETER); 234 AssertPtrNullReturn(pdx, VERR_INVALID_PARAMETER); 235 AssertPtrNullReturn(pdy, VERR_INVALID_PARAMETER); 236 AssertPtrReturn(piDisplay, VERR_INVALID_PARAMETER); 237 AssertPtrNullReturn(pfEnabled, VERR_INVALID_PARAMETER); 238 AssertPtrNullReturn(pfChangeOrigin, VERR_INVALID_PARAMETER); 239 RT_ZERO(Req); 240 rc = vmmdevInitRequest(&Req.header, VMMDevReq_GetDisplayChangeRequestEx); 241 AssertRCReturn(rc, rc); 242 if (fAck) 243 Req.eventAck = VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST; 244 rc = vbglR3GRPerform(&Req.header); 245 if (RT_SUCCESS(rc)) 246 rc = Req.header.rc; 247 if (RT_SUCCESS(rc)) 248 { 249 *pcx = Req.xres; 250 *pcy = Req.yres; 251 *pcBits = Req.bpp; 252 *piDisplay = Req.display; 253 if (pdx) 254 *pdx = Req.cxOrigin; 255 if (pdy) 256 *pdy = Req.cyOrigin; 257 if (pfEnabled) 258 *pfEnabled = Req.fEnabled; 259 if (pfChangeOrigin) 260 *pfChangeOrigin = Req.fChangeOrigin; 261 } 262 /* NEEDS TESTING: test below with current Additions on VBox 4.1 or older. */ 263 /** @todo Can we find some standard grep-able string for "NEEDS TESTING"? */ 264 if (rc == VERR_NOT_IMPLEMENTED) /* Fall back to the old API. */ 265 { 266 if (pfEnabled) 267 *pfEnabled = true; 268 if (pfChangeOrigin) 269 *pfChangeOrigin = false; 270 return getDisplayChangeRequest2(pcx, pcy, pcBits, piDisplay, fAck); 248 271 } 249 272 return rc; -
trunk/src/VBox/Additions/haiku/VBoxTray/VBoxDisplay.cpp
r43406 r52956 130 130 { 131 131 uint32_t cx, cy, cBits, iDisplay; 132 int rc2 = VbglR3GetDisplayChangeRequest(&cx, &cy, &cBits, &iDisplay, true);132 int rc2 = VbglR3GetDisplayChangeRequest(&cx, &cy, &cBits, &iDisplay, NULL, NULL, NULL, NULL, true); 133 133 LogFlow(("rc2=%d screen %d size changed (%d, %d, %d)\n", rc2, iDisplay, cx, cy, cBits)); 134 134 -
trunk/src/VBox/Additions/x11/VBoxClient/display.cpp
r52586 r52956 118 118 static void setModeX11(struct x11State *pState, unsigned cx, unsigned cy, 119 119 unsigned cBPP, unsigned iDisplay, unsigned x, 120 unsigned y, bool fEnabled, bool f SetPosition)120 unsigned y, bool fEnabled, bool fChangeOrigin) 121 121 { 122 122 char szCommand[256]; … … 135 135 pState->cSizeHints = iDisplay + 1; 136 136 } 137 if ((!f SetPosition || fEnabled) && cx != 0 && cy != 0)137 if ((!fChangeOrigin || fEnabled) && cx != 0 && cy != 0) 138 138 { 139 139 pState->paSizeHints[iDisplay] = (cx & 0xffff) << 16 | (cy & 0xffff); … … 155 155 else 156 156 { 157 if (f SetPosition && fEnabled)157 if (fChangeOrigin && fEnabled) 158 158 { 159 159 /* Extended Display support possible . Secondary monitor … … 166 166 VBClFatalError(("Failed to execute \\\"%s\\\".\n", szCommand)); 167 167 } 168 if ((!f SetPosition || fEnabled) && cx != 0 && cy != 0)168 if ((!fChangeOrigin || fEnabled) && cx != 0 && cy != 0) 169 169 { 170 170 RTStrPrintf(szCommand, sizeof(szCommand), … … 252 252 { 253 253 uint32_t cx = 0, cy = 0, cBPP = 0, iDisplay = 0, x = 0, y = 0; 254 bool fEnabled = true, f SetPosition = true;254 bool fEnabled = true, fChangeOrigin = true; 255 255 VMMDevSeamlessMode Mode; 256 256 257 rc = VbglR3GetDisplayChangeRequest Ex(&cx, &cy, &cBPP, &iDisplay,258 259 257 rc = VbglR3GetDisplayChangeRequest(&cx, &cy, &cBPP, &iDisplay, 258 &x, &y, &fEnabled, 259 &fChangeOrigin, true); 260 260 /* Extended display version not supported on host */ 261 261 if (RT_FAILURE(rc)) 262 { 263 if (rc != VERR_NOT_IMPLEMENTED) 264 VBClFatalError(("Failed to get display change request, rc=%Rrc\n", 262 VBClFatalError(("Failed to get display change request, rc=%Rrc\n", 265 263 rc)); 266 fSetPosition = false;267 rc = VbglR3GetDisplayChangeRequest(&cx, &cy, &cBPP,268 &iDisplay, true);269 if (RT_SUCCESS(rc))270 LogRelFlowFunc(("Got size hint from host cx=%d, cy=%d, bpp=%d, iDisplay=%d\n",271 cx, cy, cBPP, iDisplay));272 }273 264 else 274 265 LogRelFlowFunc(("Got extended size hint from host cx=%d, cy=%d, bpp=%d, iDisplay=%d, x=%d, y=%d fEnabled=%d\n", … … 293 284 } 294 285 setModeX11(pState, cx, cy, cBPP, iDisplay, x, y, fEnabled, 295 f SetPosition);286 fChangeOrigin); 296 287 } 297 288 }
Note:
See TracChangeset
for help on using the changeset viewer.