Changeset 83200 in vbox for trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp
- Timestamp:
- Mar 4, 2020 3:13:17 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp
r83173 r83200 54 54 #include <X11/extensions/shape.h> 55 55 #include <X11/extensions/Xrandr.h> 56 #include <X11/extensions/panoramiXproto.h> 57 58 #ifndef sz_XineramaScreenInfo 59 #define sz_XineramaScreenInfo 8 60 #endif 56 61 57 62 /** Maximum number of supported screens. DRM and X11 both limit this to 32. */ … … 68 73 #define OLD_JUNK 69 74 70 struct X11VMWRECT /* xXineramaScreenInfo in Xlib headers. */ 75 typedef struct { 76 CARD8 reqType; /* always X_VMwareCtrlReqCode */ 77 CARD8 VMwareCtrlReqType; /* always X_VMwareCtrlSetTopology */ 78 CARD16 length B16; 79 CARD32 screen B32; 80 CARD32 number B32; 81 CARD32 pad1 B32; 82 } xVMwareCtrlSetTopologyReq; 83 #define sz_xVMwareCtrlSetTopologyReq 16 84 85 #define X_VMwareCtrlSetTopology 2 86 87 typedef struct { 88 BYTE type; /* X_Reply */ 89 BYTE pad1; 90 CARD16 sequenceNumber B16; 91 CARD32 length B32; 92 CARD32 screen B32; 93 CARD32 pad2 B32; 94 CARD32 pad3 B32; 95 CARD32 pad4 B32; 96 CARD32 pad5 B32; 97 CARD32 pad6 B32; 98 } xVMwareCtrlSetTopologyReply; 99 #define sz_xVMwareCtrlSetTopologyReply 32 100 101 struct X11VMWRECT 71 102 { 72 103 int16_t x; … … 81 112 Display *pDisplay; 82 113 int hRandRMajor; 83 int hVMW Major;114 int hVMWCtrlMajorOpCode; 84 115 int hRandRMinor; 85 116 int hRandREventBase; … … 101 132 static const char *pcszCvt = "cvt"; 102 133 103 struct DRMCONTEXT104 {105 RTFILE hDevice;106 };107 108 134 struct RANDROUTPUT 109 135 { … … 121 147 122 148 #ifndef OLD_JUNK 149 150 bool VMwareCtrlSetTopology(Display *dpy, int hExtensionMajorOpcode, 151 int screen, xXineramaScreenInfo extents[], int number) 152 { 153 xVMwareCtrlSetTopologyReply rep; 154 xVMwareCtrlSetTopologyReq *req; 155 156 long len; 157 158 LockDisplay(dpy); 159 160 GetReq(VMwareCtrlSetTopology, req); 161 req->reqType = hExtensionMajorOpcode; 162 req->VMwareCtrlReqType = X_VMwareCtrlSetTopology; 163 req->screen = screen; 164 req->number = number; 165 166 len = ((long) number) << 1; 167 SetReqLen(req, len, len); 168 len <<= 2; 169 _XSend(dpy, (char *)extents, len); 170 171 if (!_XReply(dpy, (xReply *)&rep, 172 (SIZEOF(xVMwareCtrlSetTopologyReply) - SIZEOF(xReply)) >> 2, 173 xFalse)) 174 { 175 UnlockDisplay(dpy); 176 SyncHandle(); 177 return false; 178 } 179 UnlockDisplay(dpy); 180 SyncHandle(); 181 return true; 182 } 183 123 184 /** This function assumes monitors are named as from Virtual1 to VirtualX. */ 124 185 static int getMonitorIdFromName(const char *sMonitorName) … … 270 331 } 271 332 333 static bool callVMWCTRL() 334 { 335 #ifndef OLD_JUNK 336 const int hHeight = 600; 337 const int hWidth = 800; 338 339 xXineramaScreenInfo *extents = (xXineramaScreenInfo *)malloc(x11Context.hOutputCount * sizeof(xXineramaScreenInfo)); 340 if (!extents) 341 return false; 342 int hRunningOffset = 0; 343 for (int i = 0; i < x11Context.hOutputCount; ++i) 344 { 345 extents[i].x_org = hRunningOffset; 346 extents[i].y_org = 0; 347 extents[i].width = hWidth; 348 extents[i].height = hHeight; 349 hRunningOffset += hWidth; 350 } 351 return VMwareCtrlSetTopology(x11Context.pDisplay, x11Context.hVMWCtrlMajorOpCode, 352 DefaultScreen(x11Context.pDisplay), 353 extents, x11Context.hOutputCount); 354 #else 355 return true; 356 #endif 357 } 358 272 359 static bool init() 273 360 { … … 275 362 if (x11Context.pDisplay == NULL) 276 363 return false; 364 callVMWCTRL(); 277 365 if (RT_FAILURE(startX11MonitorThread())) 278 366 return false; … … 302 390 return; 303 391 if (!XQueryExtension(x11Context.pDisplay, "VMWARE_CTRL", 304 &x11Context.hVMW Major, &dummy, &dummy))392 &x11Context.hVMWCtrlMajorOpCode, &dummy, &dummy)) 305 393 { 306 394 XCloseDisplay(x11Context.pDisplay);
Note:
See TracChangeset
for help on using the changeset viewer.