Changeset 83224 in vbox for trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp
- Timestamp:
- Mar 6, 2020 5:48:36 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp
r83217 r83224 54 54 #include <X11/extensions/panoramiXproto.h> 55 55 56 #define OLD_JUNK57 58 //#define DL_OPEN_RANDR59 60 56 /** Maximum number of supported screens. DRM and X11 both limit this to 32. */ 61 57 /** @todo if this ever changes, dynamically allocate resizeable arrays in the … … 121 117 Bool (*pXRRQueryExtension) (Display *, int *, int *); 122 118 Status (*pXRRQueryVersion) (Display *, int *, int*); 119 XRRMonitorInfo* (*pXRRGetMonitors)(Display *, Window, Bool, int *); 120 void (*pXRRFreeMonitors)(XRRMonitorInfo *); 123 121 }; 124 122 … … 181 179 } 182 180 183 #ifndef OLD_JUNK184 181 /** This function assumes monitors are named as from Virtual1 to VirtualX. */ 185 182 static int getMonitorIdFromName(const char *sMonitorName) … … 222 219 } 223 220 224 XRRScreenResources *pScreenResources = XRRGetScreenResources(x11Context.pDisplay, DefaultRootWindow(x11Context.pDisplay));225 AssertReturnVoid(pScreenResources);226 XRRFreeScreenResources(pScreenResources);221 // XRRScreenResources *pScreenResources = XRRGetScreenResources(x11Context.pDisplay, DefaultRootWindow(x11Context.pDisplay)); 222 // AssertReturnVoid(pScreenResources); 223 // XRRFreeScreenResources(pScreenResources); 227 224 228 225 int iMonitorCount = 0; 229 XRRMonitorInfo *pMonitorInfo = XRRGetMonitors(x11Context.pDisplay, DefaultRootWindow(x11Context.pDisplay), true, &iMonitorCount); 226 XRRMonitorInfo *pMonitorInfo = NULL; 227 #ifdef WITH_DISTRO_XRAND_XINERAMA 228 pMonitorInfo = XRRGetMonitors(x11Context.pDisplay, DefaultRootWindow(x11Context.pDisplay), true, &iMonitorCount); 229 #else 230 if (x11Context.pXRRGetMonitors) 231 x11Context.pXRRGetMonitors(x11Context.pDisplay, DefaultRootWindow(x11Context.pDisplay), true, &iMonitorCount); 232 #endif 233 if (!pMonitorInfo) 234 return; 230 235 if (iMonitorCount == -1) 231 236 VBClLogError("Could not get monitor info\n"); … … 254 259 sendMonitorPositions(mpMonitorPositions, x11Context.hOutputCount); 255 260 } 261 #ifdef WITH_DISTRO_XRAND_XINERAMA 256 262 XRRFreeMonitors(pMonitorInfo); 257 } 263 #else 264 if (x11Context.pXRRFreeMonitors) 265 x11Context.pXRRFreeMonitors(pMonitorInfo); 258 266 #endif 267 } 259 268 260 269 static void monitorRandREvents() 261 270 { 262 #ifndef OLD_JUNK263 271 XEvent event; 264 272 XNextEvent(x11Context.pDisplay, &event); … … 277 285 break; 278 286 } 279 #endif280 287 } 281 288 … … 333 340 static bool callVMWCTRL() 334 341 { 335 #ifndef OLD_JUNK336 342 const int hHeight = 600; 337 343 const int hWidth = 800; … … 352 358 DefaultScreen(x11Context.pDisplay), 353 359 extents, x11Context.hOutputCount); 354 #else355 return true;356 #endif357 360 } 358 361 … … 365 368 if (RT_FAILURE(startX11MonitorThread())) 366 369 return false; 367 #ifdef DL_OPEN_RANDR 370 #ifdef WITH_DISTRO_XRAND_XINERAMA 371 XRRSelectInput(x11Context.pDisplay, x11Context.rootWindow, x11Context.hEventMask); 372 #else 368 373 if (x11Context.pXRRSelectInput) 369 374 x11Context.pXRRSelectInput(x11Context.pDisplay, x11Context.rootWindow, x11Context.hEventMask); 370 #else371 XRRSelectInput(x11Context.pDisplay, x11Context.rootWindow, x11Context.hEventMask);372 375 #endif 373 376 return true; … … 387 390 x11Context.pRandLibraryHandle = NULL; 388 391 } 389 #ifdef DL_OPEN_RANDR 392 #ifdef WITH_DISTRO_XRAND_XINERAMA 393 XRRSelectInput(x11Context.pDisplay, x11Context.rootWindow, 0); 394 #else 390 395 if (x11Context.pXRRSelectInput) 391 396 x11Context.pXRRSelectInput(x11Context.pDisplay, x11Context.rootWindow, 0); 392 #else393 XRRSelectInput(x11Context.pDisplay, x11Context.rootWindow, 0);394 397 #endif 395 398 XCloseDisplay(x11Context.pDisplay); 396 399 } 397 400 398 #if def DL_OPEN_RANDR401 #ifndef WITH_DISTRO_XRAND_XINERAMA 399 402 static int openLibRandR() 400 403 { … … 434 437 return VERR_NOT_FOUND; 435 438 } 439 440 x11Context.pXRRGetMonitors = (XRRMonitorInfo* (*)(Display *, Window, Bool, int *)) 441 dlsym(x11Context.pRandLibraryHandle, "XRRGetMonitors"); 442 if (!x11Context.pXRRGetMonitors) 443 { 444 VBClLogFatalError("Could not find address for the symbol XRRGetMonitors\n"); 445 dlclose(x11Context.pRandLibraryHandle); 446 x11Context.pRandLibraryHandle = NULL; 447 return VERR_NOT_FOUND; 448 } 449 450 x11Context.pXRRFreeMonitors = (void (*)(XRRMonitorInfo *)) 451 dlsym(x11Context.pRandLibraryHandle, "XRRFreeMonitors"); 452 if (!x11Context.pXRRFreeMonitors) 453 { 454 VBClLogFatalError("Could not find address for the symbol XRRFreeMonitors\n"); 455 dlclose(x11Context.pRandLibraryHandle); 456 x11Context.pRandLibraryHandle = NULL; 457 return VERR_NOT_FOUND; 458 } 459 436 460 return VINF_SUCCESS; 437 461 } … … 454 478 } 455 479 bool fSuccess = false; 456 #ifdef DL_OPEN_RANDR 480 #ifdef WITH_DISTRO_XRAND_XINERAMA 481 fSuccess = XRRQueryExtension(x11Context.pDisplay, &x11Context.hRandREventBase, &x11Context.hRandRErrorBase); 482 #else 457 483 if (x11Context.pXRRQueryExtension) 458 484 fSuccess = x11Context.pXRRQueryExtension(x11Context.pDisplay, &x11Context.hRandREventBase, &x11Context.hRandRErrorBase); 459 #else460 fSuccess = XRRQueryExtension(x11Context.pDisplay, &x11Context.hRandREventBase, &x11Context.hRandRErrorBase);461 485 #endif 462 486 if (fSuccess) 463 487 { 464 488 fSuccess = false; 465 #ifdef DL_OPEN_RANDR 489 #ifdef WITH_DISTRO_XRAND_XINERAMA 490 fSuccess = XRRQueryVersion(x11Context.pDisplay, &x11Context.hRandRMajor, &x11Context.hRandRMinor); 491 #else 466 492 if (x11Context.pXRRQueryVersion) 467 493 fSuccess = x11Context.pXRRQueryVersion(x11Context.pDisplay, &x11Context.hRandRMajor, &x11Context.hRandRMinor); 468 #else469 fSuccess = XRRQueryVersion(x11Context.pDisplay, &x11Context.hRandRMajor, &x11Context.hRandRMinor);470 494 #endif 471 495 if (!fSuccess) … … 477 501 } 478 502 x11Context.hEventMask = 0; 479 #ifndef OLD_JUNK480 503 x11Context.hEventMask = RRScreenChangeNotifyMask; 481 504 if (x11Context.hRandRMinor >= 2) … … 483 506 | RROutputChangeNotifyMask 484 507 | RROutputPropertyNotifyMask; 485 #endif486 508 x11Context.rootWindow = DefaultRootWindow(x11Context.pDisplay); 487 509 x11Context.hOutputCount = determineOutputCount(); … … 490 512 x11Context.pXRRQueryExtension = NULL; 491 513 x11Context.pXRRQueryVersion = NULL; 492 #ifdef DL_OPEN_RANDR 514 x11Context.pXRRGetMonitors = NULL; 515 x11Context.pXRRFreeMonitors = NULL; 516 #ifndef WITH_DISTRO_XRAND_XINERAMA 493 517 if (openLibRandR() != VINF_SUCCESS) 494 518 {
Note:
See TracChangeset
for help on using the changeset viewer.