Remove "screen" argument from Randr glue functions
Screen is a Xvnc thing and not relevant for x0vncserver etc.
diff --git a/unix/common/RandrGlue.h b/unix/common/RandrGlue.h
index 40d2d2e..48ce327 100644
--- a/unix/common/RandrGlue.h
+++ b/unix/common/RandrGlue.h
@@ -30,31 +30,31 @@
extern "C" {
#endif
-int vncGetScreenWidth(int scrIdx);
-int vncGetScreenHeight(int scrIdx);
+int vncGetScreenWidth(void);
+int vncGetScreenHeight(void);
-int vncRandRResizeScreen(int scrIdx, int width, int height);
-void vncRandRUpdateSetTime(int scrIdx);
+int vncRandRResizeScreen(int width, int height);
+void vncRandRUpdateSetTime(void);
-int vncRandRHasOutputClones(int scrIdx);
+int vncRandRHasOutputClones(void);
-int vncRandRGetOutputCount(int scrIdx);
-int vncRandRGetAvailableOutputs(int scrIdx);
+int vncRandRGetOutputCount(void);
+int vncRandRGetAvailableOutputs(void);
-char *vncRandRGetOutputName(int scrIdx, int outputIdx);
+char *vncRandRGetOutputName(int outputIdx);
-int vncRandRIsOutputEnabled(int scrIdx, int outputIdx);
-int vncRandRIsOutputUsable(int scrIdx, int outputIdx);
+int vncRandRIsOutputEnabled(int outputIdx);
+int vncRandRIsOutputUsable(int outputIdx);
-int vncRandRDisableOutput(int scrIdx, int outputIdx);
-int vncRandRReconfigureOutput(int scrIdx, int outputIdx, int x, int y,
+int vncRandRDisableOutput(int outputIdx);
+int vncRandRReconfigureOutput(int outputIdx, int x, int y,
int width, int height);
-unsigned int vncRandRGetOutputId(int scrIdx, int outputIdx);
-void vncRandRGetOutputDimensions(int scrIdx, int outputIdx,
+unsigned int vncRandRGetOutputId(int outputIdx);
+void vncRandRGetOutputDimensions(int outputIdx,
int *x, int *y, int *width, int *height);
-int vncRandRCreateOutputs(int scrIdx, int extraOutputs);
+int vncRandRCreateOutputs(int extraOutputs);
void *vncRandRCreatePreferredMode(void *output, int width, int height);
#ifdef __cplusplus
diff --git a/unix/common/randr.cxx b/unix/common/randr.cxx
index 08bd45e..8581991 100644
--- a/unix/common/randr.cxx
+++ b/unix/common/randr.cxx
@@ -30,20 +30,20 @@
#include <RandrGlue.h>
static rfb::LogWriter vlog("RandR");
-rfb::ScreenSet computeScreenLayout(int screenIndex, OutputIdMap *outputIdMap)
+rfb::ScreenSet computeScreenLayout(OutputIdMap *outputIdMap)
{
rfb::ScreenSet layout;
OutputIdMap newIdMap;
- for (int i = 0;i < vncRandRGetOutputCount(screenIndex);i++) {
+ for (int i = 0;i < vncRandRGetOutputCount();i++) {
unsigned int outputId;
int x, y, width, height;
/* Disabled? */
- if (!vncRandRIsOutputEnabled(screenIndex, i))
+ if (!vncRandRIsOutputEnabled(i))
continue;
- outputId = vncRandRGetOutputId(screenIndex, i);
+ outputId = vncRandRGetOutputId(i);
/* Known output? */
if (outputIdMap->count(outputId) == 1)
@@ -65,7 +65,7 @@
newIdMap[outputId] = id;
}
- vncRandRGetOutputDimensions(screenIndex, i, &x, &y, &width, &height);
+ vncRandRGetOutputDimensions(i, &x, &y, &width, &height);
layout.add_screen(rfb::Screen(newIdMap[outputId], x, y, width, height, 0));
}
@@ -78,41 +78,39 @@
* that we have no active outputs...
*/
if (layout.num_screens() == 0)
- layout.add_screen(rfb::Screen(0, 0, 0, vncGetScreenWidth(screenIndex),
- vncGetScreenHeight(screenIndex), 0));
+ layout.add_screen(rfb::Screen(0, 0, 0, vncGetScreenWidth(),
+ vncGetScreenHeight(), 0));
return layout;
}
-unsigned int setScreenLayout(int screenIndex,
- int fb_width, int fb_height, const rfb::ScreenSet& layout,
+unsigned int setScreenLayout(int fb_width, int fb_height, const rfb::ScreenSet& layout,
OutputIdMap *outputIdMap)
{
int ret;
int availableOutputs;
// RandR support?
- if (vncRandRGetOutputCount(screenIndex) == 0)
+ if (vncRandRGetOutputCount() == 0)
return rfb::resultProhibited;
/*
* First check that we don't have any active clone modes. That's just
* too messy to deal with.
*/
- if (vncRandRHasOutputClones(screenIndex)) {
+ if (vncRandRHasOutputClones()) {
vlog.error("Clone mode active. Refusing to touch screen layout.");
return rfb::resultInvalid;
}
/* Next count how many useful outputs we have... */
- availableOutputs = vncRandRGetAvailableOutputs(screenIndex);
+ availableOutputs = vncRandRGetAvailableOutputs();
/* Try to create more outputs if needed... (only works on Xvnc) */
if (layout.num_screens() > availableOutputs) {
vlog.debug("Insufficient screens. Need to create %d more.",
layout.num_screens() - availableOutputs);
- ret = vncRandRCreateOutputs(screenIndex,
- layout.num_screens() - availableOutputs);
+ ret = vncRandRCreateOutputs(layout.num_screens() - availableOutputs);
if (!ret) {
vlog.error("Unable to create more screens, as needed by the new client layout.");
return rfb::resultInvalid;
@@ -120,9 +118,9 @@
}
/* First we might need to resize the screen */
- if ((fb_width != vncGetScreenWidth(screenIndex)) ||
- (fb_height != vncGetScreenHeight(screenIndex))) {
- ret = vncRandRResizeScreen(screenIndex, fb_width, fb_height);
+ if ((fb_width != vncGetScreenWidth()) ||
+ (fb_height != vncGetScreenHeight())) {
+ ret = vncRandRResizeScreen(fb_width, fb_height);
if (!ret) {
vlog.error("Failed to resize screen to %dx%d", fb_width, fb_height);
return rfb::resultInvalid;
@@ -130,12 +128,12 @@
}
/* Next, reconfigure all known outputs, and turn off the other ones */
- for (int i = 0;i < vncRandRGetOutputCount(screenIndex);i++) {
+ for (int i = 0;i < vncRandRGetOutputCount();i++) {
unsigned int output;
rfb::ScreenSet::const_iterator iter;
- output = vncRandRGetOutputId(screenIndex, i);
+ output = vncRandRGetOutputId(i);
/* Known? */
if (outputIdMap->count(output) == 0)
@@ -150,9 +148,9 @@
/* Missing? */
if (iter == layout.end()) {
/* Disable and move on... */
- ret = vncRandRDisableOutput(screenIndex, i);
+ ret = vncRandRDisableOutput(i);
if (!ret) {
- char *name = vncRandRGetOutputName(screenIndex, i);
+ char *name = vncRandRGetOutputName(i);
vlog.error("Failed to disable unused output '%s'",
name);
free(name);
@@ -163,13 +161,13 @@
}
/* Reconfigure new mode and position */
- ret = vncRandRReconfigureOutput(screenIndex, i,
+ ret = vncRandRReconfigureOutput(i,
iter->dimensions.tl.x,
iter->dimensions.tl.y,
iter->dimensions.width(),
iter->dimensions.height());
if (!ret) {
- char *name = vncRandRGetOutputName(screenIndex, i);
+ char *name = vncRandRGetOutputName(i);
vlog.error("Failed to reconfigure output '%s' to %dx%d+%d+%d",
name,
iter->dimensions.width(), iter->dimensions.height(),
@@ -196,22 +194,22 @@
continue;
/* Find an unused output */
- for (i = 0;i < vncRandRGetOutputCount(screenIndex);i++) {
- output = vncRandRGetOutputId(screenIndex, i);
+ for (i = 0;i < vncRandRGetOutputCount();i++) {
+ output = vncRandRGetOutputId(i);
/* In use? */
if (outputIdMap->count(output) == 1)
continue;
/* Can it be used? */
- if (!vncRandRIsOutputUsable(screenIndex, i))
+ if (!vncRandRIsOutputUsable(i))
continue;
break;
}
/* Shouldn't happen */
- if (i == vncRandRGetOutputCount(screenIndex))
+ if (i == vncRandRGetOutputCount())
return rfb::resultInvalid;
/*
@@ -222,13 +220,13 @@
(*outputIdMap)[output] = iter->id;
/* Reconfigure new mode and position */
- ret = vncRandRReconfigureOutput(screenIndex, i,
+ ret = vncRandRReconfigureOutput(i,
iter->dimensions.tl.x,
iter->dimensions.tl.y,
iter->dimensions.width(),
iter->dimensions.height());
if (!ret) {
- char *name = vncRandRGetOutputName(screenIndex, i);
+ char *name = vncRandRGetOutputName(i);
vlog.error("Failed to reconfigure output '%s' to %dx%d+%d+%d",
name,
iter->dimensions.width(), iter->dimensions.height(),
@@ -243,7 +241,7 @@
* This is normally done in the X11 request handlers, which is
* why we have to deal with it manually here.
*/
- vncRandRUpdateSetTime(screenIndex);
+ vncRandRUpdateSetTime();
return rfb::resultSuccess;
}
diff --git a/unix/common/unixcommon.h b/unix/common/unixcommon.h
index 66fe84c..5f5c8d6 100644
--- a/unix/common/unixcommon.h
+++ b/unix/common/unixcommon.h
@@ -30,10 +30,9 @@
typedef std::map<unsigned int, rdr::U32> OutputIdMap;
-rfb::ScreenSet computeScreenLayout(int screenIndex, OutputIdMap *outputIdMap);
+rfb::ScreenSet computeScreenLayout(OutputIdMap *outputIdMap);
-unsigned int setScreenLayout(int screenIndex,
- int fb_width, int fb_height, const rfb::ScreenSet& layout,
+unsigned int setScreenLayout(int fb_width, int fb_height, const rfb::ScreenSet& layout,
OutputIdMap *outputIdMap);