]> source.dussan.org Git - tigervnc.git/commitdiff
vncRandRDisableOutput: Disable only the requested output
authorPeter Åstrand (astrand) <astrand@cendio.se>
Tue, 27 Mar 2018 07:25:02 +0000 (09:25 +0200)
committerPeter Åstrand (astrand) <astrand@cendio.se>
Mon, 9 Apr 2018 09:04:00 +0000 (11:04 +0200)
This only matters when using clones, which we do not accept yet. This
patch is for completeness and to avoid future surprises.

unix/xserver/hw/vnc/RandrGlue.c

index ddf671e0ecd1e46b0e0ec76c3355f4e1c82eae16..214b1d0d1cec354d3c6f42ba9d7d0bb2858f8cef 100644 (file)
@@ -177,12 +177,37 @@ int vncRandRDisableOutput(int outputIdx)
 {
   rrScrPrivPtr rp = rrGetScrPriv(screenInfo.screens[scrIdx]);
   RRCrtcPtr crtc;
+  int i;
+  RROutputPtr *outputs;
+  int numOutputs = 0;
+  RRModePtr mode;
+  int ret;
 
   crtc = rp->outputs[outputIdx]->crtc;
   if (crtc == NULL)
     return 1;
 
-  return RRCrtcSet(crtc, NULL, crtc->x, crtc->y, crtc->rotation, 0, NULL);
+  /* Remove this output from the CRTC configuration */
+  outputs = malloc(crtc->numOutputs * sizeof(RROutputPtr));
+  if (!outputs) {
+    return 0;
+  }
+
+  for (i = 0; i < crtc->numOutputs; i++) {
+    if (rp->outputs[outputIdx] != crtc->outputs[i]) {
+      outputs[numOutputs++] = crtc->outputs[i];
+    }
+  }
+
+  if (numOutputs == 0) {
+    mode = NULL;
+  } else {
+    mode = crtc->mode;
+  }
+
+  ret = RRCrtcSet(crtc, mode, crtc->x, crtc->y, crtc->rotation, numOutputs, outputs);
+  free(outputs);
+  return ret;
 }
 
 unsigned int vncRandRGetOutputId(int outputIdx)