diff options
author | Peter Åstrand (astrand) <astrand@cendio.se> | 2018-03-27 09:25:02 +0200 |
---|---|---|
committer | Peter Åstrand (astrand) <astrand@cendio.se> | 2018-04-09 11:04:00 +0200 |
commit | 423702593627c4a5eb59f11fbb7b02732c82b371 (patch) | |
tree | d7fffacd759a7d09fe09a0e58c8bb7580a1873f7 /unix/xserver | |
parent | d57acc34e7fe0960215fc65703020e2d53393d22 (diff) | |
download | tigervnc-423702593627c4a5eb59f11fbb7b02732c82b371.tar.gz tigervnc-423702593627c4a5eb59f11fbb7b02732c82b371.zip |
vncRandRDisableOutput: Disable only the requested output
This only matters when using clones, which we do not accept yet. This
patch is for completeness and to avoid future surprises.
Diffstat (limited to 'unix/xserver')
-rw-r--r-- | unix/xserver/hw/vnc/RandrGlue.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/unix/xserver/hw/vnc/RandrGlue.c b/unix/xserver/hw/vnc/RandrGlue.c index ddf671e0..214b1d0d 100644 --- a/unix/xserver/hw/vnc/RandrGlue.c +++ b/unix/xserver/hw/vnc/RandrGlue.c @@ -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) |