2023-12-14 01:28:44 +00:00
|
|
|
Add "display_name" configuration option and use its value instead of the hard
|
|
|
|
coded one.
|
2019-04-28 12:48:47 +00:00
|
|
|
|
|
|
|
Patch by Diego N. Barbato
|
2023-12-14 01:28:44 +00:00
|
|
|
---
|
|
|
|
app.cpp | 23 ++++++++++-------------
|
|
|
|
cfg.cpp | 1 +
|
|
|
|
switchuser.cpp | 2 +-
|
|
|
|
3 files changed, 12 insertions(+), 14 deletions(-)
|
2019-04-28 12:48:47 +00:00
|
|
|
|
2023-12-14 01:28:44 +00:00
|
|
|
diff --git a/app.cpp b/app.cpp
|
|
|
|
index b840e60..4f72da0 100644
|
|
|
|
--- a/app.cpp
|
|
|
|
+++ b/app.cpp
|
|
|
|
@@ -270,7 +270,16 @@ App::App(int argc, char** argv)
|
2019-04-28 12:48:47 +00:00
|
|
|
|
2023-12-14 01:28:44 +00:00
|
|
|
void App::Run()
|
|
|
|
{
|
2019-04-28 12:48:47 +00:00
|
|
|
- DisplayName = DISPLAY;
|
|
|
|
+ /* Read configuration */
|
2023-12-14 01:28:44 +00:00
|
|
|
+ if ( cfg == 0 )
|
|
|
|
+ {
|
|
|
|
+ cfg = new Cfg;
|
|
|
|
+ const char *cfgfile = getenv("SLIM_CFGFILE");
|
|
|
|
+ if (!cfgfile) cfgfile = CFGFILE;
|
|
|
|
+ cfg->readConf(cfgfile);
|
2019-04-28 12:48:47 +00:00
|
|
|
+
|
2023-12-14 01:28:44 +00:00
|
|
|
+ DisplayName = cfg->getOption("display_name").c_str();
|
|
|
|
+ }
|
2019-04-28 12:48:47 +00:00
|
|
|
|
|
|
|
#ifdef XNEST_DEBUG
|
|
|
|
char* p = getenv("DISPLAY");
|
2023-12-14 01:28:44 +00:00
|
|
|
@@ -281,14 +287,7 @@ void App::Run()
|
2019-04-28 12:48:47 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
- /* Read configuration and theme */
|
2023-12-14 01:28:44 +00:00
|
|
|
- if ( cfg == 0 )
|
|
|
|
- {
|
|
|
|
- cfg = new Cfg;
|
|
|
|
- const char* cfgfile = getenv("SLIM_CFGFILE");
|
|
|
|
- if (!cfgfile) cfgfile = CFGFILE;
|
|
|
|
- cfg->readConf(cfgfile);
|
|
|
|
- }
|
|
|
|
+ /* Read theme */
|
2019-04-28 12:48:47 +00:00
|
|
|
string themebase = "";
|
|
|
|
string themefile = "";
|
|
|
|
string themedir = "";
|
2023-12-14 01:28:44 +00:00
|
|
|
@@ -1115,9 +1114,7 @@ int App::StartServer()
|
2019-04-28 12:48:47 +00:00
|
|
|
static const int MAX_XSERVER_ARGS = 256;
|
|
|
|
static char* server[MAX_XSERVER_ARGS+2] = { NULL };
|
|
|
|
server[0] = (char *)cfg->getOption("default_xserver").c_str();
|
|
|
|
- string argOption = cfg->getOption("xserver_arguments");
|
|
|
|
- /* Add mandatory -xauth option */
|
|
|
|
- argOption = argOption + " -auth " + cfg->getOption("authfile");
|
|
|
|
+ string argOption = cfg->getOption("display_name") + " " + cfg->getOption("xserver_arguments") + " -auth " + cfg->getOption("authfile");
|
|
|
|
char* args = new char[argOption.length()+2]; /* NULL plus vt */
|
|
|
|
strcpy(args, argOption.c_str());
|
|
|
|
|
2023-12-14 01:28:44 +00:00
|
|
|
@@ -1424,7 +1421,7 @@ void App::CreateServerAuth()
|
2019-04-28 12:48:47 +00:00
|
|
|
authfile = cfg->getOption("authfile");
|
|
|
|
remove(authfile.c_str());
|
|
|
|
putenv(StrConcat("XAUTHORITY=", authfile.c_str()));
|
|
|
|
- Util::add_mcookie(mcookie, ":0", cfg->getOption("xauth_path"),
|
|
|
|
+ Util::add_mcookie(mcookie, cfg->getOption("display_name").c_str(), cfg->getOption("xauth_path"),
|
|
|
|
authfile);
|
|
|
|
}
|
|
|
|
|
2023-12-14 01:28:44 +00:00
|
|
|
diff --git a/cfg.cpp b/cfg.cpp
|
|
|
|
index 37fb10d..a0c9bf1 100644
|
|
|
|
--- a/cfg.cpp
|
|
|
|
+++ b/cfg.cpp
|
|
|
|
@@ -40,6 +40,7 @@ Cfg::Cfg()
|
2019-04-28 12:48:47 +00:00
|
|
|
/* Configuration options */
|
|
|
|
options.insert(option("default_path","/bin:/usr/bin:/usr/local/bin"));
|
|
|
|
options.insert(option("default_xserver","/usr/bin/X"));
|
|
|
|
+ options.insert(option("display_name",":0.0"));
|
|
|
|
options.insert(option("xserver_arguments",""));
|
|
|
|
options.insert(option("numlock",""));
|
|
|
|
options.insert(option("daemon",""));
|
2023-12-14 01:28:44 +00:00
|
|
|
diff --git a/switchuser.cpp b/switchuser.cpp
|
|
|
|
index ca936ae..255f5d9 100644
|
|
|
|
--- a/switchuser.cpp
|
|
|
|
+++ b/switchuser.cpp
|
|
|
|
@@ -69,6 +69,6 @@ void SwitchUser::SetClientAuth(const char* mcookie)
|
2019-04-28 12:48:47 +00:00
|
|
|
string home = string(Pw->pw_dir);
|
|
|
|
string authfile = home + "/.Xauthority";
|
|
|
|
remove(authfile.c_str());
|
|
|
|
- Util::add_mcookie(mcookie, ":0", cfg->getOption("xauth_path"),
|
2023-12-14 01:28:44 +00:00
|
|
|
+ Util::add_mcookie(mcookie, cfg->getOption("display_name").c_str(), cfg->getOption("xauth_path"),
|
2019-04-28 12:48:47 +00:00
|
|
|
authfile);
|
|
|
|
}
|
2023-12-14 01:28:44 +00:00
|
|
|
--
|
|
|
|
2.39.2
|
|
|
|
|