Changeset 55043 in vbox for trunk/src/VBox/Additions/x11/VBoxClient/display.cpp
- Timestamp:
- Mar 31, 2015 3:59:35 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/display.cpp
r54192 r55043 86 86 /** Tell the VBoxGuest driver we no longer want any events and tell the host 87 87 * we no longer support any capabilities. */ 88 static int disableEventsAndCaps( )88 static int disableEventsAndCaps(bool fDisableEvents) 89 89 { 90 90 int rc = VbglR3SetGuestCaps(0, VMMDEV_GUEST_SUPPORTS_GRAPHICS); … … 94 94 if (RT_FAILURE(rc)) 95 95 VBClFatalError(("Failed to unset mouse status, rc=%Rrc.\n", rc)); 96 rc = VbglR3CtlFilterMask(0, VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED97 96 if (fDisableEvents) 97 rc = VbglR3CtlFilterMask(0, VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED | VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST); 98 98 if (RT_FAILURE(rc)) 99 99 VBClFatalError(("Failed to unset filter mask, rc=%Rrc.\n", rc)); … … 174 174 static void updateSizeHintsProperty(struct DISPLAYSTATE *pState) 175 175 { 176 long *paSizeHints = (long *)RTMemTmpAllocZ(pState->cScreensTracked * sizeof(long) );176 long *paSizeHints = (long *)RTMemTmpAllocZ(pState->cScreensTracked * sizeof(long) * 2); 177 177 unsigned i; 178 178 … … 181 181 for (i = 0; i < pState->cScreensTracked; ++i) 182 182 { 183 if (pState->paScreenInformation[i].fEnabled) 184 paSizeHints[2 * i] = (pState->paScreenInformation[i].cx & 0x8fff) << 16 185 | (pState->paScreenInformation[i].cy & 0x8fff); 186 else if (pState->paScreenInformation[i].cx != 0 && pState->paScreenInformation[i].cy != 0) 187 paSizeHints[2 * i] = -1; 183 188 if ( pState->paScreenInformation[i].fEnabled 184 && pState->paScreenInformation[i].cx != 0 && pState->paScreenInformation[i].cy != 0) 185 paSizeHints[i] = (pState->paScreenInformation[i].cx & 0x8fff) << 16 | (pState->paScreenInformation[i].cy & 0x8fff); 186 else if (pState->paScreenInformation[i].cx != 0 && pState->paScreenInformation[i].cy != 0) 187 paSizeHints[i] = -1; 189 && pState->paScreenInformation[i].fUpdatePosition) 190 paSizeHints[2 * i + 1] = (pState->paScreenInformation[i].x & 0x8fff) << 16 191 | (pState->paScreenInformation[i].y & 0x8fff); 192 else 193 paSizeHints[2 * i + 1] = -1; 188 194 } 189 195 XChangeProperty(pState->pDisplay, DefaultRootWindow(pState->pDisplay), XInternAtom(pState->pDisplay, "VBOX_SIZE_HINTS", 0), 190 XA_INTEGER, 32, PropModeReplace, (unsigned char *)paSizeHints, pState->cScreensTracked );196 XA_INTEGER, 32, PropModeReplace, (unsigned char *)paSizeHints, pState->cScreensTracked * 2); 191 197 XFlush(pState->pDisplay); 192 198 RTMemTmpFree(paSizeHints); 193 199 } 194 200 195 static void notifyXServer (struct DISPLAYSTATE *pState)201 static void notifyXServerRandR11(struct DISPLAYSTATE *pState) 196 202 { 197 203 char szCommand[256]; 198 unsigned i;199 bool fUpdateInformation = false;200 204 201 205 /** @note The xrandr command can fail if something else accesses RandR at 202 206 * the same time. We just ignore failure for now and let the user try 203 207 * again as we do not know what someone else is doing. */ 204 for (i = 0; i < pState->cScreensTracked; ++i) 205 if (pState->paScreenInformation[i].fUpdateSize) 206 fUpdateInformation = true; 207 if ( !pState->fHaveRandR12 && pState->paScreenInformation[0].fUpdateSize 208 if ( pState->paScreenInformation[0].fUpdateSize 208 209 && pState->paScreenInformation[0].cx > 0 && pState->paScreenInformation[0].cy > 0) 209 210 { … … 212 213 system(szCommand); 213 214 pState->paScreenInformation[0].fUpdateSize = false; 214 }215 else if (pState->fHaveRandR12 && fUpdateInformation)216 for (i = 0; i < pState->cScreensTracked; ++i)217 {218 if (pState->paScreenInformation[i].fUpdateSize)219 {220 RTStrPrintf(szCommand, sizeof(szCommand), "%s --output VGA-%u --preferred", pState->pcszXrandr, i);221 system(szCommand);222 }223 if (pState->paScreenInformation[i].fUpdatePosition)224 {225 RTStrPrintf(szCommand, sizeof(szCommand), "%s --output VGA-%u --auto --pos %ux%u",226 pState->pcszXrandr, i, pState->paScreenInformation[i].x, pState->paScreenInformation[i].y);227 system(szCommand);228 }229 pState->paScreenInformation[i].fUpdateSize = pState->paScreenInformation[i].fUpdatePosition = false;230 }231 else232 {233 RTStrPrintf(szCommand, sizeof(szCommand), "%s", pState->pcszXrandr);234 system(szCommand);235 215 } 236 216 } … … 250 230 (unsigned char *)&fFeatures, 1); 251 231 XFlush(pState->pDisplay); 252 if (pState->fHaveRandR12)253 for (i = 0; i < pState->cScreensTracked; ++i)254 pState->paScreenInformation[i].fUpdateSize = true;255 else256 pState->paScreenInformation[0].fUpdateSize = true;257 232 } 258 233 … … 294 269 updateMouseCapabilities(pState); 295 270 updateSizeHintsProperty(pState); 296 notifyXServer(pState); 271 if (!pState->fHaveRandR12) 272 notifyXServerRandR11(pState); 297 273 do 298 274 rc = VbglR3WaitEvent( VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST … … 385 361 if (!pSelf->mfInit) 386 362 return VERR_WRONG_ORDER; 387 return disableEventsAndCaps( );363 return disableEventsAndCaps(false); 388 364 } 389 365 … … 400 376 { 401 377 NOREF(ppInterface); 402 disableEventsAndCaps( );378 disableEventsAndCaps(true); 403 379 VbglR3Term(); 404 380 }
Note:
See TracChangeset
for help on using the changeset viewer.