diff options
author | Peter Åstrand (astrand) <astrand@cendio.se> | 2018-03-07 12:32:30 +0100 |
---|---|---|
committer | Peter Åstrand (astrand) <astrand@cendio.se> | 2018-04-09 10:26:25 +0200 |
commit | 94ab2db366b2607391358d472dfb6f8f5eab9644 (patch) | |
tree | 7cb8e2321f1ef9e6b706b413403bdefbcfba5267 | |
parent | 1173637739194be70e4158e911a31dccf39edeb0 (diff) | |
download | tigervnc-94ab2db366b2607391358d472dfb6f8f5eab9644.tar.gz tigervnc-94ab2db366b2607391358d472dfb6f8f5eab9644.zip |
Corrected RandR wrapper return codes
In RandR land, there's a lot of return code confusion. Our wrappers
are using the same return codes as RRCrtcSet, RRScreenSizeSet: 1/TRUE
for success. Fixes:
* vncRandRCreateOutputs did not follow this convention
* A lot of code returned -1 upon failure
* vncRandRDisableOutput returned 0 for already disabled outputs
-rw-r--r-- | unix/common/randr.cxx | 2 | ||||
-rw-r--r-- | unix/xserver/hw/vnc/RandrGlue.c | 12 | ||||
-rw-r--r-- | unix/xserver/hw/vnc/vncModule.c | 2 | ||||
-rw-r--r-- | unix/xserver/hw/vnc/xvnc.c | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/unix/common/randr.cxx b/unix/common/randr.cxx index 44e46de7..08bd45e6 100644 --- a/unix/common/randr.cxx +++ b/unix/common/randr.cxx @@ -113,7 +113,7 @@ unsigned int setScreenLayout(int screenIndex, layout.num_screens() - availableOutputs); ret = vncRandRCreateOutputs(screenIndex, layout.num_screens() - availableOutputs); - if (ret < 0) { + if (!ret) { vlog.error("Unable to create more screens, as needed by the new client layout."); return rfb::resultInvalid; } diff --git a/unix/xserver/hw/vnc/RandrGlue.c b/unix/xserver/hw/vnc/RandrGlue.c index 9f770fa9..81065710 100644 --- a/unix/xserver/hw/vnc/RandrGlue.c +++ b/unix/xserver/hw/vnc/RandrGlue.c @@ -50,7 +50,7 @@ int vncRandRResizeScreen(int scrIdx, int width, int height) pScreen->mmWidth * width / pScreen->width, pScreen->mmHeight * height / pScreen->height); #else - return -1; + return 0; #endif } @@ -199,11 +199,11 @@ int vncRandRDisableOutput(int scrIdx, int outputIdx) crtc = rp->outputs[outputIdx]->crtc; if (crtc == NULL) - return 0; + return 1; return RRCrtcSet(crtc, NULL, crtc->x, crtc->y, crtc->rotation, 0, NULL); #else - return -1; + return 0; #endif } @@ -267,17 +267,17 @@ int vncRandRReconfigureOutput(int scrIdx, int outputIdx, int x, int y, /* Couldn't find one... */ if (crtc == NULL) - return -1; + return 0; } /* Make sure we have the mode we want */ mode = vncRandRCreatePreferredMode(output, width, height); if (mode == NULL) - return -1; + return 0; /* Reconfigure new mode and position */ return RRCrtcSet(crtc, mode, x, y, crtc->rotation, 1, &output); #else - return -1; + return 0; #endif } diff --git a/unix/xserver/hw/vnc/vncModule.c b/unix/xserver/hw/vnc/vncModule.c index 3fb07769..704e56ee 100644 --- a/unix/xserver/hw/vnc/vncModule.c +++ b/unix/xserver/hw/vnc/vncModule.c @@ -115,7 +115,7 @@ void vncClientGone(int fd) #ifdef RANDR int vncRandRCreateOutputs(int scrIdx, int extraOutputs) { - return -1; + return 0; } void *vncRandRCreatePreferredMode(void *out, int width, int height) diff --git a/unix/xserver/hw/vnc/xvnc.c b/unix/xserver/hw/vnc/xvnc.c index 56a6ca58..4133689b 100644 --- a/unix/xserver/hw/vnc/xvnc.c +++ b/unix/xserver/hw/vnc/xvnc.c @@ -1387,11 +1387,11 @@ int vncRandRCreateOutputs(int scrIdx, int extraOutputs) while (extraOutputs > 0) { crtc = vncRandRCrtcCreate(screenInfo.screens[scrIdx]); if (crtc == NULL) - return -1; + return 0; extraOutputs--; } - return 0; + return 1; } /* Used to create a preferred mode from various places */ |