summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorPeter Åstrand (astrand) <astrand@cendio.se>2018-03-19 10:47:40 +0100
committerPeter Åstrand (astrand) <astrand@cendio.se>2018-04-09 11:03:57 +0200
commitd57acc34e7fe0960215fc65703020e2d53393d22 (patch)
treefcb83438851ff60161691e0e29b77be9af8d3e97 /unix
parentffeda0767ff1c61c72627f4aacb1526764630161 (diff)
downloadtigervnc-d57acc34e7fe0960215fc65703020e2d53393d22.tar.gz
tigervnc-d57acc34e7fe0960215fc65703020e2d53393d22.zip
Make vncRandRGetOutputDimensions tolerant for disabled outputs
Return error if no CRTC.
Diffstat (limited to 'unix')
-rw-r--r--unix/common/RandrGlue.h2
-rw-r--r--unix/common/randr.cxx6
-rw-r--r--unix/xserver/hw/vnc/RandrGlue.c19
3 files changed, 17 insertions, 10 deletions
diff --git a/unix/common/RandrGlue.h b/unix/common/RandrGlue.h
index 48ce3273..43c9b685 100644
--- a/unix/common/RandrGlue.h
+++ b/unix/common/RandrGlue.h
@@ -51,7 +51,7 @@ int vncRandRReconfigureOutput(int outputIdx, int x, int y,
int width, int height);
unsigned int vncRandRGetOutputId(int outputIdx);
-void vncRandRGetOutputDimensions(int outputIdx,
+int vncRandRGetOutputDimensions(int outputIdx,
int *x, int *y, int *width, int *height);
int vncRandRCreateOutputs(int extraOutputs);
diff --git a/unix/common/randr.cxx b/unix/common/randr.cxx
index 85819916..b0adc3fd 100644
--- a/unix/common/randr.cxx
+++ b/unix/common/randr.cxx
@@ -65,9 +65,9 @@ rfb::ScreenSet computeScreenLayout(OutputIdMap *outputIdMap)
newIdMap[outputId] = id;
}
- vncRandRGetOutputDimensions(i, &x, &y, &width, &height);
-
- layout.add_screen(rfb::Screen(newIdMap[outputId], x, y, width, height, 0));
+ if (vncRandRGetOutputDimensions(i, &x, &y, &width, &height) == 0) {
+ layout.add_screen(rfb::Screen(newIdMap[outputId], x, y, width, height, 0));
+ }
}
/* Only keep the entries that are currently active */
diff --git a/unix/xserver/hw/vnc/RandrGlue.c b/unix/xserver/hw/vnc/RandrGlue.c
index 86ec8bcc..ddf671e0 100644
--- a/unix/xserver/hw/vnc/RandrGlue.c
+++ b/unix/xserver/hw/vnc/RandrGlue.c
@@ -191,18 +191,24 @@ unsigned int vncRandRGetOutputId(int outputIdx)
return rp->outputs[outputIdx]->id;
}
-void vncRandRGetOutputDimensions(int outputIdx,
+int vncRandRGetOutputDimensions(int outputIdx,
int *x, int *y, int *width, int *height)
{
rrScrPrivPtr rp = rrGetScrPriv(screenInfo.screens[scrIdx]);
+ RRCrtcPtr crtc;
int swap;
+ *x = *y = *width = *height = 0;
- *x = rp->outputs[outputIdx]->crtc->x;
- *y = rp->outputs[outputIdx]->crtc->y;
- *width = rp->outputs[outputIdx]->crtc->mode->mode.width;
- *height = rp->outputs[outputIdx]->crtc->mode->mode.height;
+ crtc = rp->outputs[outputIdx]->crtc;
+ if (crtc == NULL || !crtc->mode)
+ return 1;
- switch (rp->outputs[outputIdx]->crtc->rotation & 0xf) {
+ *x = crtc->x;
+ *y = crtc->y;
+ *width = crtc->mode->mode.width;
+ *height = crtc->mode->mode.height;
+
+ switch (crtc->rotation & 0xf) {
case RR_Rotate_90:
case RR_Rotate_270:
swap = *width;
@@ -210,6 +216,7 @@ void vncRandRGetOutputDimensions(int outputIdx,
*height = swap;
break;
}
+ return 0;
}
int vncRandRReconfigureOutput(int outputIdx, int x, int y,