summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorPeter Åstrand (astrand) <astrand@cendio.se>2018-03-20 08:10:12 +0100
committerPeter Åstrand (astrand) <astrand@cendio.se>2018-04-09 20:28:40 +0200
commit396f8c9fb5847c1959f1e18231969a923b9e6066 (patch)
tree66ca92ecae590021c801ed335b44dd3d8dadbc4f /unix
parent423702593627c4a5eb59f11fbb7b02732c82b371 (diff)
downloadtigervnc-396f8c9fb5847c1959f1e18231969a923b9e6066.tar.gz
tigervnc-396f8c9fb5847c1959f1e18231969a923b9e6066.zip
Disable outputs which are larger than the target framebuffer size
Apparently this is not necessary when using the internal API, but a must with libXrandr.
Diffstat (limited to 'unix')
-rw-r--r--unix/common/randr.cxx22
1 files changed, 21 insertions, 1 deletions
diff --git a/unix/common/randr.cxx b/unix/common/randr.cxx
index b0adc3fd..8514817c 100644
--- a/unix/common/randr.cxx
+++ b/unix/common/randr.cxx
@@ -30,6 +30,26 @@
#include <RandrGlue.h>
static rfb::LogWriter vlog("RandR");
+static int ResizeScreen(int fb_width, int fb_height)
+{
+ /*
+ * Disable outputs which are larger than the target size
+ */
+ for (int i = 0;i < vncRandRGetOutputCount();i++) {
+ int x, y, width, height;
+ if (vncRandRGetOutputDimensions(i, &x, &y, &width, &height) == 0) {
+ if (x + width > fb_width || y + height > fb_height) {
+ /* Currently ignoring errors */
+ /* FIXME: Save output rotation and restore when configuring output */
+ vncRandRDisableOutput(i);
+ }
+ }
+ }
+
+ return vncRandRResizeScreen(fb_width, fb_height);
+}
+
+
rfb::ScreenSet computeScreenLayout(OutputIdMap *outputIdMap)
{
rfb::ScreenSet layout;
@@ -120,7 +140,7 @@ unsigned int setScreenLayout(int fb_width, int fb_height, const rfb::ScreenSet&
/* First we might need to resize the screen */
if ((fb_width != vncGetScreenWidth()) ||
(fb_height != vncGetScreenHeight())) {
- ret = vncRandRResizeScreen(fb_width, fb_height);
+ ret = ResizeScreen(fb_width, fb_height);
if (!ret) {
vlog.error("Failed to resize screen to %dx%d", fb_width, fb_height);
return rfb::resultInvalid;