Changeset 83137 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Feb 21, 2020 9:18:29 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 136254
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp
r83136 r83137 42 42 #include <VBox/VBoxGuestLib.h> 43 43 44 #include <iprt/asm.h> 44 45 #include <iprt/assert.h> 45 46 #include <iprt/err.h> … … 62 63 /** Thread to listen to some of the X server events. */ 63 64 RTTHREAD mX11MonitorThread = NIL_RTTHREAD; 65 /** Shutdown indicator for the monitor thread. */ 66 static bool g_fMonitorThreadShutdown = false; 64 67 65 68 struct X11VMWRECT /* xXineramaScreenInfo in Xlib headers. */ … … 201 204 break; 202 205 default: 203 VBClLogInfo("Unknown RR event \n");206 VBClLogInfo("Unknown RR event: %d\n", event.type); 204 207 break; 205 208 } 206 209 } 207 210 208 int x11MonitorThreadFunction(RTTHREAD hThreadSelf, void *pvUser) 209 { 210 (void)hThreadSelf; 211 (void*)pvUser; 212 while(1) 211 /** 212 * @callback_method_impl{FNRTTHREAD} 213 */ 214 static DECLCALLBACK(int) x11MonitorThreadFunction(RTTHREAD hThreadSelf, void *pvUser) 215 { 216 RT_NOREF(hThreadSelf, pvUser); 217 while (!ASMAtomicReadBool(&g_fMonitorThreadShutdown)) 213 218 { 214 219 monitorRandREvents(); … … 221 226 int rc; 222 227 228 Assert(g_fMonitorThreadShutdown == false); 223 229 if (mX11MonitorThread == NIL_RTTHREAD) 224 230 { 225 rc = RTThreadCreate(&mX11MonitorThread, x11MonitorThreadFunction, 0, 0, 226 RTTHREADTYPE_MSG_PUMP, RTTHREADFLAGS_WAITABLE, 227 "X11 events"); 231 rc = RTThreadCreate(&mX11MonitorThread, x11MonitorThreadFunction, NULL /*pvUser*/, 0 /*cbStack*/, 232 RTTHREADTYPE_MSG_PUMP, RTTHREADFLAGS_WAITABLE, "X11 events"); 228 233 if (RT_FAILURE(rc)) 229 234 VBClLogFatalError("Warning: failed to start X11 monitor thread (VBoxClient) rc=%Rrc!\n", rc); 230 235 } 236 else 237 rc = VINF_ALREADY_INITIALIZED; 231 238 return rc; 232 239 } … … 237 244 if (mX11MonitorThread != NIL_RTTHREAD) 238 245 { 246 ASMAtomicWriteBool(&g_fMonitorThreadShutdown, true); 247 /** @todo Send event to thread to get it out of XNextEvent. */ 239 248 //???????? 240 249 //mX11Monitor.interruptEventWait(); 241 rc = RTThreadWait(mX11MonitorThread, 1000, NULL);250 rc = RTThreadWait(mX11MonitorThread, RT_MS_1SEC, NULL /*prc*/); 242 251 if (RT_SUCCESS(rc)) 252 { 243 253 mX11MonitorThread = NIL_RTTHREAD; 254 g_fMonitorThreadShutdown = false; 255 } 244 256 else 245 257 VBClLogError("Failed to stop X11 monitor thread, rc=%Rrc!\n", rc); … … 279 291 if (x11Context.pDisplay == NULL) 280 292 return; 281 if (!XQueryExtension(x11Context.pDisplay, "VMWARE_CTRL",282 &x11Context.hVMWMajor, &dummy, &dummy))293 if (!XQueryExtension(x11Context.pDisplay, "VMWARE_CTRL", 294 &x11Context.hVMWMajor, &dummy, &dummy)) 283 295 { 284 296 XCloseDisplay(x11Context.pDisplay); … … 297 309 x11Context.hEventMask = RRScreenChangeNotifyMask; 298 310 if (x11Context.hRandRMinor >= 2) 299 x11Context.hEventMask |= RRCrtcChangeNotifyMask |300 RROutputChangeNotifyMask |301 RROutputPropertyNotifyMask;311 x11Context.hEventMask |= RRCrtcChangeNotifyMask 312 | RROutputChangeNotifyMask 313 | RROutputPropertyNotifyMask; 302 314 x11Context.rootWindow = DefaultRootWindow(x11Context.pDisplay); 303 315 x11Context.hOutputCount = determineOutputCount(); … … 343 355 bool fInitialSpace = true; 344 356 345 while (*p)357 while (*p) 346 358 { 347 359 if (*p != ' ') … … 353 365 if (iNameIndex >= 4) 354 366 { 355 if ( outPszModeName[iNameIndex-1] == 'x' &&356 outPszModeName[iNameIndex-2] == 'o' &&357 outPszModeName[iNameIndex-3] == 'b')367 if ( outPszModeName[iNameIndex-1] == 'x' 368 && outPszModeName[iNameIndex-2] == 'o' 369 && outPszModeName[iNameIndex-3] == 'b') 358 370 break; 359 371 } … … 539 551 static int run(struct VBCLSERVICE **ppInterface, bool fDaemonised) 540 552 { 541 (void)ppInterface; 542 (void)fDaemonised; 553 RT_NOREF(ppInterface, fDaemonised); 543 554 int rc; 544 555 uint32_t events; … … 562 573 int eventMask = RRScreenChangeNotifyMask; 563 574 if (x11Context.hRandRMinor >= 2) 564 eventMask |= RRCrtcChangeNotifyMask |565 RROutputChangeNotifyMask |566 RROutputPropertyNotifyMask;575 eventMask |= RRCrtcChangeNotifyMask 576 | RROutputChangeNotifyMask 577 | RROutputPropertyNotifyMask; 567 578 if (x11Context.hRandRMinor >= 4) 568 eventMask |= RRProviderChangeNotifyMask |569 RRProviderPropertyNotifyMask |570 RRResourceChangeNotifyMask;579 eventMask |= RRProviderChangeNotifyMask 580 | RRProviderPropertyNotifyMask 581 | RRResourceChangeNotifyMask; 571 582 for (;;) 572 583 { … … 591 602 if (!(aDisplays[i].fDisplayFlags & VMMDEV_DISPLAY_DISABLED)) 592 603 { 593 if ( (idDisplay == 0)|| (aDisplays[i].fDisplayFlags & VMMDEV_DISPLAY_ORIGIN))604 if (idDisplay == 0 || (aDisplays[i].fDisplayFlags & VMMDEV_DISPLAY_ORIGIN)) 594 605 { 595 606 aMonitors[idDisplay].xOrigin = aDisplays[i].xOrigin;
Note:
See TracChangeset
for help on using the changeset viewer.