| 1 | Add "display_name" configuration option and use its value instead of the hard
|
| 2 | coded one.
|
| 3 |
|
| 4 | Patch by Diego N. Barbato
|
| 5 | ---
|
| 6 | app.cpp | 23 ++++++++++-------------
|
| 7 | cfg.cpp | 1 +
|
| 8 | switchuser.cpp | 2 +-
|
| 9 | 3 files changed, 12 insertions(+), 14 deletions(-)
|
| 10 |
|
| 11 | diff --git a/app.cpp b/app.cpp
|
| 12 | index b840e60..4f72da0 100644
|
| 13 | |
| 14 | |
| 15 | @@ -270,7 +270,16 @@ App::App(int argc, char** argv)
|
| 16 |
|
| 17 | void App::Run()
|
| 18 | {
|
| 19 | - DisplayName = DISPLAY;
|
| 20 | + /* Read configuration */
|
| 21 | + if ( cfg == 0 )
|
| 22 | + {
|
| 23 | + cfg = new Cfg;
|
| 24 | + const char *cfgfile = getenv("SLIM_CFGFILE");
|
| 25 | + if (!cfgfile) cfgfile = CFGFILE;
|
| 26 | + cfg->readConf(cfgfile);
|
| 27 | +
|
| 28 | + DisplayName = cfg->getOption("display_name").c_str();
|
| 29 | + }
|
| 30 |
|
| 31 | #ifdef XNEST_DEBUG
|
| 32 | char* p = getenv("DISPLAY");
|
| 33 | @@ -281,14 +287,7 @@ void App::Run()
|
| 34 | }
|
| 35 | #endif
|
| 36 |
|
| 37 | - /* Read configuration and theme */
|
| 38 | - if ( cfg == 0 )
|
| 39 | - {
|
| 40 | - cfg = new Cfg;
|
| 41 | - const char* cfgfile = getenv("SLIM_CFGFILE");
|
| 42 | - if (!cfgfile) cfgfile = CFGFILE;
|
| 43 | - cfg->readConf(cfgfile);
|
| 44 | - }
|
| 45 | + /* Read theme */
|
| 46 | string themebase = "";
|
| 47 | string themefile = "";
|
| 48 | string themedir = "";
|
| 49 | @@ -1115,9 +1114,7 @@ int App::StartServer()
|
| 50 | static const int MAX_XSERVER_ARGS = 256;
|
| 51 | static char* server[MAX_XSERVER_ARGS+2] = { NULL };
|
| 52 | server[0] = (char *)cfg->getOption("default_xserver").c_str();
|
| 53 | - string argOption = cfg->getOption("xserver_arguments");
|
| 54 | - /* Add mandatory -xauth option */
|
| 55 | - argOption = argOption + " -auth " + cfg->getOption("authfile");
|
| 56 | + string argOption = cfg->getOption("display_name") + " " + cfg->getOption("xserver_arguments") + " -auth " + cfg->getOption("authfile");
|
| 57 | char* args = new char[argOption.length()+2]; /* NULL plus vt */
|
| 58 | strcpy(args, argOption.c_str());
|
| 59 |
|
| 60 | @@ -1424,7 +1421,7 @@ void App::CreateServerAuth()
|
| 61 | authfile = cfg->getOption("authfile");
|
| 62 | remove(authfile.c_str());
|
| 63 | putenv(StrConcat("XAUTHORITY=", authfile.c_str()));
|
| 64 | - Util::add_mcookie(mcookie, ":0", cfg->getOption("xauth_path"),
|
| 65 | + Util::add_mcookie(mcookie, cfg->getOption("display_name").c_str(), cfg->getOption("xauth_path"),
|
| 66 | authfile);
|
| 67 | }
|
| 68 |
|
| 69 | diff --git a/cfg.cpp b/cfg.cpp
|
| 70 | index 37fb10d..a0c9bf1 100644
|
| 71 | |
| 72 | |
| 73 | @@ -40,6 +40,7 @@ Cfg::Cfg()
|
| 74 | /* Configuration options */
|
| 75 | options.insert(option("default_path","/bin:/usr/bin:/usr/local/bin"));
|
| 76 | options.insert(option("default_xserver","/usr/bin/X"));
|
| 77 | + options.insert(option("display_name",":0.0"));
|
| 78 | options.insert(option("xserver_arguments",""));
|
| 79 | options.insert(option("numlock",""));
|
| 80 | options.insert(option("daemon",""));
|
| 81 | diff --git a/switchuser.cpp b/switchuser.cpp
|
| 82 | index ca936ae..255f5d9 100644
|
| 83 | |
| 84 | |
| 85 | @@ -69,6 +69,6 @@ void SwitchUser::SetClientAuth(const char* mcookie)
|
| 86 | string home = string(Pw->pw_dir);
|
| 87 | string authfile = home + "/.Xauthority";
|
| 88 | remove(authfile.c_str());
|
| 89 | - Util::add_mcookie(mcookie, ":0", cfg->getOption("xauth_path"),
|
| 90 | + Util::add_mcookie(mcookie, cfg->getOption("display_name").c_str(), cfg->getOption("xauth_path"),
|
| 91 | authfile);
|
| 92 | }
|
| 93 | --
|
| 94 | 2.39.2
|
| 95 |
|