|
|
c65c35 |
From 38c6848b30cb1908171f2b4628e345fbf6727b39 Mon Sep 17 00:00:00 2001
|
|
|
c65c35 |
From: Pierre Ossman <ossman@cendio.se>
|
|
|
c65c35 |
Date: Fri, 18 Sep 2020 10:44:32 +0200
|
|
|
c65c35 |
Subject: [PATCH] Tolerate specifying -BoolParam 0 and similar
|
|
|
c65c35 |
|
|
|
c65c35 |
This is needed by vncserver which doesn't know which parameters are
|
|
|
c65c35 |
boolean, and it cannot use the -Param=Value form as that isn't tolerated
|
|
|
c65c35 |
by the Xorg code.
|
|
|
c65c35 |
---
|
|
|
c65c35 |
unix/vncserver/vncserver.in | 8 ++++----
|
|
|
c65c35 |
unix/xserver/hw/vnc/RFBGlue.cc | 16 ++++++++++++++++
|
|
|
c65c35 |
unix/xserver/hw/vnc/RFBGlue.h | 1 +
|
|
|
c65c35 |
unix/xserver/hw/vnc/xvnc.c | 14 ++++++++++++++
|
|
|
c65c35 |
vncviewer/vncviewer.cxx | 20 ++++++++++++++++++++
|
|
|
c65c35 |
5 files changed, 55 insertions(+), 4 deletions(-)
|
|
|
c65c35 |
|
|
|
c65c35 |
diff --git a/unix/vncserver/vncserver.in b/unix/vncserver/vncserver.in
|
|
|
c65c35 |
index 25fbbd315..261b258f1 100755
|
|
|
c65c35 |
--- a/unix/vncserver/vncserver.in
|
|
|
c65c35 |
+++ b/unix/vncserver/vncserver.in
|
|
|
c65c35 |
@@ -107,7 +107,7 @@ $default_opts{rfbwait} = 30000;
|
|
|
c65c35 |
$default_opts{rfbauth} = "$vncUserDir/passwd";
|
|
|
c65c35 |
$default_opts{rfbport} = $vncPort;
|
|
|
c65c35 |
$default_opts{fp} = $fontPath if ($fontPath);
|
|
|
c65c35 |
-$default_opts{pn} = "";
|
|
|
c65c35 |
+$default_opts{pn} = undef;
|
|
|
c65c35 |
|
|
|
c65c35 |
# Load user-overrideable system defaults
|
|
|
c65c35 |
LoadConfig($vncSystemConfigDefaultsFile);
|
|
|
c65c35 |
@@ -242,13 +242,13 @@ push(@cmd, "@CMAKE_INSTALL_FULL_BINDIR@/Xvnc", ":$displayNumber");
|
|
|
c65c35 |
|
|
|
c65c35 |
foreach my $k (sort keys %config) {
|
|
|
c65c35 |
push(@cmd, "-$k");
|
|
|
c65c35 |
- push(@cmd, $config{$k}) if $config{$k};
|
|
|
c65c35 |
+ push(@cmd, $config{$k}) if defined($config{$k});
|
|
|
c65c35 |
delete $default_opts{$k}; # file options take precedence
|
|
|
c65c35 |
}
|
|
|
c65c35 |
|
|
|
c65c35 |
foreach my $k (sort keys %default_opts) {
|
|
|
c65c35 |
push(@cmd, "-$k");
|
|
|
c65c35 |
- push(@cmd, $default_opts{$k}) if $default_opts{$k};
|
|
|
c65c35 |
+ push(@cmd, $default_opts{$k}) if defined($default_opts{$k});
|
|
|
c65c35 |
}
|
|
|
c65c35 |
|
|
|
c65c35 |
warn "\nNew '$desktopName' desktop is $host:$displayNumber\n\n";
|
|
|
c65c35 |
@@ -291,7 +291,7 @@ sub LoadConfig {
|
|
|
c65c35 |
# current config file being loaded defined the logical opposite setting
|
|
|
c65c35 |
# (NeverShared vs. AlwaysShared, etc etc).
|
|
|
c65c35 |
$toggle = lc($1); # must normalize key case
|
|
|
c65c35 |
- $config{$toggle} = $k;
|
|
|
c65c35 |
+ $config{$toggle} = undef;
|
|
|
c65c35 |
}
|
|
|
c65c35 |
}
|
|
|
c65c35 |
close(IN);
|
|
|
c65c35 |
diff --git a/unix/xserver/hw/vnc/RFBGlue.cc b/unix/xserver/hw/vnc/RFBGlue.cc
|
|
|
c65c35 |
index f108fae43..7c32bea8f 100644
|
|
|
c65c35 |
--- a/unix/xserver/hw/vnc/RFBGlue.cc
|
|
|
c65c35 |
+++ b/unix/xserver/hw/vnc/RFBGlue.cc
|
|
|
c65c35 |
@@ -143,6 +143,22 @@ const char* vncGetParamDesc(const char *name)
|
|
|
c65c35 |
return param->getDescription();
|
|
|
c65c35 |
}
|
|
|
c65c35 |
|
|
|
c65c35 |
+int vncIsParamBool(const char *name)
|
|
|
c65c35 |
+{
|
|
|
c65c35 |
+ VoidParameter *param;
|
|
|
c65c35 |
+ BoolParameter *bparam;
|
|
|
c65c35 |
+
|
|
|
c65c35 |
+ param = rfb::Configuration::getParam(name);
|
|
|
c65c35 |
+ if (param == NULL)
|
|
|
c65c35 |
+ return false;
|
|
|
c65c35 |
+
|
|
|
c65c35 |
+ bparam = dynamic_cast<BoolParameter*>(param);
|
|
|
c65c35 |
+ if (bparam == NULL)
|
|
|
c65c35 |
+ return false;
|
|
|
c65c35 |
+
|
|
|
c65c35 |
+ return true;
|
|
|
c65c35 |
+}
|
|
|
c65c35 |
+
|
|
|
c65c35 |
int vncGetParamCount(void)
|
|
|
c65c35 |
{
|
|
|
c65c35 |
int count;
|
|
|
c65c35 |
diff --git a/unix/xserver/hw/vnc/RFBGlue.h b/unix/xserver/hw/vnc/RFBGlue.h
|
|
|
c65c35 |
index 112405b84..695cea105 100644
|
|
|
c65c35 |
--- a/unix/xserver/hw/vnc/RFBGlue.h
|
|
|
c65c35 |
+++ b/unix/xserver/hw/vnc/RFBGlue.h
|
|
|
c65c35 |
@@ -41,6 +41,7 @@ int vncSetParam(const char *name, const char *value);
|
|
|
c65c35 |
int vncSetParamSimple(const char *nameAndValue);
|
|
|
c65c35 |
char* vncGetParam(const char *name);
|
|
|
c65c35 |
const char* vncGetParamDesc(const char *name);
|
|
|
c65c35 |
+int vncIsParamBool(const char *name);
|
|
|
c65c35 |
|
|
|
c65c35 |
int vncGetParamCount(void);
|
|
|
c65c35 |
char *vncGetParamList(void);
|
|
|
c65c35 |
diff --git a/unix/xserver/hw/vnc/xvnc.c b/unix/xserver/hw/vnc/xvnc.c
|
|
|
c65c35 |
index 4eb0b0b13..5744acac8 100644
|
|
|
c65c35 |
--- a/unix/xserver/hw/vnc/xvnc.c
|
|
|
c65c35 |
+++ b/unix/xserver/hw/vnc/xvnc.c
|
|
|
c65c35 |
@@ -618,6 +618,20 @@ ddxProcessArgument(int argc, char *argv[], int i)
|
|
|
c65c35 |
exit(0);
|
|
|
c65c35 |
}
|
|
|
c65c35 |
|
|
|
c65c35 |
+ /* We need to resolve an ambiguity for booleans */
|
|
|
c65c35 |
+ if (argv[i][0] == '-' && i+1 < argc &&
|
|
|
c65c35 |
+ vncIsParamBool(&argv[i][1])) {
|
|
|
c65c35 |
+ if ((strcasecmp(argv[i+1], "0") == 0) ||
|
|
|
c65c35 |
+ (strcasecmp(argv[i+1], "1") == 0) ||
|
|
|
c65c35 |
+ (strcasecmp(argv[i+1], "true") == 0) ||
|
|
|
c65c35 |
+ (strcasecmp(argv[i+1], "false") == 0) ||
|
|
|
c65c35 |
+ (strcasecmp(argv[i+1], "yes") == 0) ||
|
|
|
c65c35 |
+ (strcasecmp(argv[i+1], "no") == 0)) {
|
|
|
c65c35 |
+ vncSetParam(&argv[i][1], argv[i+1]);
|
|
|
c65c35 |
+ return 2;
|
|
|
c65c35 |
+ }
|
|
|
c65c35 |
+ }
|
|
|
c65c35 |
+
|
|
|
c65c35 |
if (vncSetParamSimple(argv[i]))
|
|
|
c65c35 |
return 1;
|
|
|
c65c35 |
|
|
|
c65c35 |
diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx
|
|
|
c65c35 |
index d4dd3063c..77ba3d3f4 100644
|
|
|
c65c35 |
--- a/vncviewer/vncviewer.cxx
|
|
|
c65c35 |
+++ b/vncviewer/vncviewer.cxx
|
|
|
c65c35 |
@@ -556,6 +556,26 @@ int main(int argc, char** argv)
|
|
|
c65c35 |
}
|
|
|
c65c35 |
|
|
|
c65c35 |
for (int i = 1; i < argc;) {
|
|
|
c65c35 |
+ /* We need to resolve an ambiguity for booleans */
|
|
|
c65c35 |
+ if (argv[i][0] == '-' && i+1 < argc) {
|
|
|
c65c35 |
+ VoidParameter *param;
|
|
|
c65c35 |
+
|
|
|
c65c35 |
+ param = Configuration::getParam(&argv[i][1]);
|
|
|
c65c35 |
+ if ((param != NULL) &&
|
|
|
c65c35 |
+ (dynamic_cast<BoolParameter*>(param) != NULL)) {
|
|
|
c65c35 |
+ if ((strcasecmp(argv[i+1], "0") == 0) ||
|
|
|
c65c35 |
+ (strcasecmp(argv[i+1], "1") == 0) ||
|
|
|
c65c35 |
+ (strcasecmp(argv[i+1], "true") == 0) ||
|
|
|
c65c35 |
+ (strcasecmp(argv[i+1], "false") == 0) ||
|
|
|
c65c35 |
+ (strcasecmp(argv[i+1], "yes") == 0) ||
|
|
|
c65c35 |
+ (strcasecmp(argv[i+1], "no") == 0)) {
|
|
|
c65c35 |
+ param->setParam(argv[i+1]);
|
|
|
c65c35 |
+ i += 2;
|
|
|
c65c35 |
+ continue;
|
|
|
c65c35 |
+ }
|
|
|
c65c35 |
+ }
|
|
|
c65c35 |
+ }
|
|
|
c65c35 |
+
|
|
|
c65c35 |
if (Configuration::setParam(argv[i])) {
|
|
|
c65c35 |
i++;
|
|
|
c65c35 |
continue;
|