Changeset 90057 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jul 6, 2021 11:19:50 AM (4 years ago)
- Location:
- trunk/src/VBox/Additions/x11/VBoxClient
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp
r89766 r90057 24 24 #include <iprt/assert.h> 25 25 #include <iprt/vector.h> 26 #include <iprt/thread.h> 26 27 #include <VBox/log.h> 27 28 … … 105 106 stop(); 106 107 mHostCallback = NULL; 107 if (mDisplay) 108 XCloseDisplay(mDisplay); 109 mDisplay = NULL; 108 109 /* Before closing a Display, make sure X11 is still running. The indicator 110 * that is when XOpenDisplay() returns non NULL. If it is not a 111 * case, XCloseDisplay() will hang on internal X11 mutex forever. */ 112 Display *pDisplay = XOpenDisplay(NULL); 113 if (pDisplay) 114 { 115 XCloseDisplay(pDisplay); 116 if (mDisplay) 117 { 118 XCloseDisplay(mDisplay); 119 mDisplay = NULL; 120 } 121 } 122 110 123 if (mpRects) 111 124 { … … 331 344 } 332 345 mChanged = false; 333 /* We execute this even when seamless is disabled, as it also waits for 334 * enable and disable notification. */ 335 XNextEvent(mDisplay, &event); 346 347 if (XPending(mDisplay) > 0) 348 { 349 /* We execute this even when seamless is disabled, as it also waits for 350 * enable and disable notification. */ 351 XNextEvent(mDisplay, &event); 352 } else 353 { 354 /* This function is called in a loop by upper layer. In order to 355 * prevent CPU spinning, sleep a bit before returning. */ 356 RTThreadSleep(300 /* ms */); 357 return; 358 } 359 336 360 if (!mEnabled) 337 361 return; … … 524 548 if (pDisplay == NULL) 525 549 { 526 VBClLog FatalError("Failed to open X11 display\n");550 VBClLogError("Failed to open X11 display\n"); 527 551 return false; 528 552 } -
trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp
r86416 r90057 316 316 event_return->xmap.window = g_SmlsEventWindow; 317 317 return True; 318 } 319 320 /* Mock XNextEvent(): this also should not be needed. Just in case, always 321 * return that at least one event is pending to be processed. */ 322 extern "C" int XPending(Display *display); 323 int XPending(Display *display) 324 { 325 RT_NOREF1(display); 326 return 1; 318 327 } 319 328
Note:
See TracChangeset
for help on using the changeset viewer.