Changeset 57344 in vbox for trunk/src/VBox/Additions/x11/VBoxClient/seamless.cpp
- Timestamp:
- Aug 14, 2015 9:22:27 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/seamless.cpp
r55401 r57344 41 41 mX11MonitorThreadStopping = false; 42 42 mMode = VMMDev_Seamless_Disabled; 43 mfPaused = false;43 mfPaused = true; 44 44 } 45 45 … … 87 87 if (RT_FAILURE(rc)) 88 88 break; 89 rc = startX11MonitorThread(); 90 if (RT_FAILURE(rc)) 91 break; 89 92 } while(0); 90 93 if (RT_FAILURE(rc)) 91 LogRel(("VBoxClient (seamless): failed to start. Stage: \"%s\" Error: %Rrc\n",94 VBClFatalError(("VBoxClient (seamless): failed to start. Stage: \"%s\" Error: %Rrc\n", 92 95 pcszStage, rc)); 93 96 return rc; … … 170 173 if (RT_SUCCESS(rc) || rc == VERR_TRY_AGAIN) 171 174 { 172 if (mMode == VMMDev_Seamless_Visible_Region && !mfPaused) 173 /* This does it's own logging on failure. */ 174 rc = startX11MonitorThread(); 175 if (mMode == VMMDev_Seamless_Visible_Region) 176 mfPaused = false; 175 177 else 176 /* This does it's own logging on failure. */177 rc = stopX11MonitorThread();178 mfPaused = true; 179 mX11Monitor.interruptEventWait(); 178 180 } 179 181 else … … 183 185 LogRelFlowFunc(("returning %Rrc\n", rc)); 184 186 return rc; 185 }186 187 int SeamlessMain::cancelEvent(void)188 {189 return VbglR3InterruptEventWaits();190 187 } 191 188 … … 199 196 200 197 LogRelFlowFunc(("\n")); 201 rc = pHost->mX11Monitor.start(); 202 if (RT_SUCCESS(rc)) 203 { 204 while (!pHost->mX11MonitorThreadStopping) 205 pHost->mX11Monitor.nextConfigurationEvent(); 206 pHost->mX11Monitor.stop(); 198 while (!pHost->mX11MonitorThreadStopping) 199 { 200 if (!pHost->mfPaused) 201 { 202 rc = pHost->mX11Monitor.start(); 203 if (RT_FAILURE(rc)) 204 VBClFatalError(("Failed to change the X11 seamless service state, mfPaused=%RTbool, rc=%Rrc\n", 205 pHost->mfPaused, rc)); 206 } 207 pHost->mX11Monitor.nextConfigurationEvent(); 208 if (pHost->mfPaused || pHost->mX11MonitorThreadStopping) 209 pHost->mX11Monitor.stop(); 207 210 } 208 211 LogRelFlowFunc(("returning %Rrc\n", rc)); … … 248 251 } 249 252 250 /** Pause the service loop. */251 int SeamlessMain::pause()252 {253 int rc;254 const char *pcszStage;255 256 LogRelFlowFunc(("\n"));257 mfPaused = true;258 do {259 pcszStage = "Reporting end of support for seamless capability";260 rc = VbglR3SeamlessSetCap(false);261 if (RT_FAILURE(rc))262 break;263 pcszStage = "Interrupting the event loop";264 rc = cancelEvent();265 if (RT_FAILURE(rc))266 break;267 } while (0);268 if (RT_FAILURE(rc))269 LogRelFunc(("Failure. Stage: \"%s\" Error: %Rrc (VBoxClient)\n",270 pcszStage, rc));271 return rc;272 }273 274 /** Resume after pausing. */275 int SeamlessMain::resume()276 {277 int rc;278 const char *pcszStage;279 280 LogRelFlowFunc(("\n"));281 mfPaused = false;282 do {283 pcszStage = "Reporting support for seamless capability";284 rc = VbglR3SeamlessSetCap(true);285 if (RT_FAILURE(rc))286 break;287 pcszStage = "Interrupting the event loop";288 rc = cancelEvent();289 if (RT_FAILURE(rc))290 break;291 } while (0);292 if (RT_FAILURE(rc))293 LogRelFunc(("Failure. Stage: \"%s\" Error: %Rrc (VBoxClient)\n",294 pcszStage, rc));295 return rc;296 }297 298 253 /** @todo Expand this? */ 299 254 int SeamlessMain::selfTest() … … 382 337 if (!pSelf->mIsInitialised) 383 338 return VERR_INTERNAL_ERROR; 384 rc = VBClStartVTMonitor();385 if (RT_FAILURE(rc))386 VBClFatalError(("Failed to start the VT monitor thread: %Rrc\n", rc));387 339 /* This only exits on error. */ 388 340 rc = pSelf->mSeamless.run(); … … 391 343 } 392 344 393 static int pause(struct VBCLSERVICE **ppInterface)394 {395 struct SEAMLESSSERVICE *pSelf = getClassFromInterface(ppInterface);396 397 return pSelf->mSeamless.pause();398 }399 400 static int resume(struct VBCLSERVICE **ppInterface)401 {402 struct SEAMLESSSERVICE *pSelf = getClassFromInterface(ppInterface);403 404 return pSelf->mSeamless.resume();405 }406 407 345 static void cleanup(struct VBCLSERVICE **ppInterface) 408 346 { … … 417 355 init, 418 356 run, 419 pause,420 resume,357 VBClServiceDefaultHandler, /* pause */ 358 VBClServiceDefaultHandler, /* resume */ 421 359 cleanup 422 360 };
Note:
See TracChangeset
for help on using the changeset viewer.