From 0a0e582597be681488b91eb818c8a1963d13adbf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20=C3=85strand=20=28astrand=29?= Date: Wed, 18 Oct 2017 08:54:05 +0200 Subject: [PATCH] x0vncserver does not support SetDesktopSize; remove -AcceptSetDesktopSize Add a Configuration::removeParam to support such cases. --- common/rfb/Configuration.cxx | 18 ++++++++++++++++++ common/rfb/Configuration.h | 6 ++++++ unix/x0vncserver/x0vncserver.cxx | 3 +++ 3 files changed, 27 insertions(+) diff --git a/common/rfb/Configuration.cxx b/common/rfb/Configuration.cxx index a5c23028..418a0c93 100644 --- a/common/rfb/Configuration.cxx +++ b/common/rfb/Configuration.cxx @@ -1,5 +1,6 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. * Copyright 2004-2005 Cendio AB. + * Copyright 2017 Peter Astrand for Cendio AB * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -166,6 +167,23 @@ void Configuration::list(int width, int nameWidth) { } +bool Configuration::remove(const char* param) { + VoidParameter *current = head; + VoidParameter **prevnext = &head; + + while (current) { + if (strcasecmp(current->getName(), param) == 0) { + *prevnext = current->_next; + return true; + } + prevnext = ¤t->_next; + current = current->_next; + } + + return false; +} + + // -=- VoidParameter VoidParameter::VoidParameter(const char* name_, const char* desc_, diff --git a/common/rfb/Configuration.h b/common/rfb/Configuration.h index d319915a..6197317b 100644 --- a/common/rfb/Configuration.h +++ b/common/rfb/Configuration.h @@ -80,6 +80,9 @@ namespace rfb { // - List the parameters of this Configuration group void list(int width=79, int nameWidth=10); + // - Remove a parameter from this Configuration group + bool remove(const char* param); + // - readFromFile // Read configuration parameters from the specified file. void readFromFile(const char* filename); @@ -116,6 +119,9 @@ namespace rfb { static void listParams(int width=79, int nameWidth=10) { global()->list(width, nameWidth); } + static bool removeParam(const char* param) { + return global()->remove(param); + } private: friend class VoidParameter; diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx index 744f802e..22525d5e 100644 --- a/unix/x0vncserver/x0vncserver.cxx +++ b/unix/x0vncserver/x0vncserver.cxx @@ -258,6 +258,9 @@ int main(int argc, char** argv) Configuration::enableServerParams(); + // Disable configuration parameters which we do not support + Configuration::removeParam("AcceptSetDesktopSize"); + for (int i = 1; i < argc; i++) { if (Configuration::setParam(argv[i])) continue; -- 2.39.5