summaryrefslogtreecommitdiffstats
path: root/kwin/kompmgr
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-14 07:17:16 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-14 07:17:16 +0000
commit7bf4b536155b448b01f7e127be787177305a3b28 (patch)
tree6e7c2c4e8cc801960912f0b12f1fd88420e5eb0c /kwin/kompmgr
parent9edbe3af0952290b348c005f8095137444dcb16c (diff)
downloadtdebase-7bf4b536155b448b01f7e127be787177305a3b28.tar.gz
tdebase-7bf4b536155b448b01f7e127be787177305a3b28.zip
Reload kompmgr settings on user switch
Check for null passwd struct in kdm kgapp git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1247005 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kwin/kompmgr')
-rw-r--r--kwin/kompmgr/kompmgr.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/kwin/kompmgr/kompmgr.c b/kwin/kompmgr/kompmgr.c
index 2aef59772..cb7ab2f59 100644
--- a/kwin/kompmgr/kompmgr.c
+++ b/kwin/kompmgr/kompmgr.c
@@ -74,6 +74,12 @@ check baghira.sf.net for more infos
#define _BOTTOMHEIGHT_(x) ((x >> 8) & 0xff)
#define _LEFTWIDTH_(x) (x & 0xff)
+/* #define USE_ENV_HOME */
+
+#ifndef USE_ENV_HOME
+#include <pwd.h>
+#endif
+
typedef struct _ignore {
struct _ignore *next;
unsigned long sequence;
@@ -289,6 +295,30 @@ void handle_siguser (int sig)
printf("Setting kompmgr process uid to %d...\n\r", uidnum); fflush(stdout);
#endif
setuid(uidnum);
+
+#ifdef USE_ENV_HOME
+ const char *home = getenv("HOME");
+#else
+ const char *home;
+ struct passwd *p;
+ p = getpwuid(uidnum);
+ if (p)
+ home = p->pw_dir;
+ else
+ home = getenv("HOME");
+#endif
+ const char *filename;
+ const char *configfile = "/.xcompmgrrc";
+ int n = strlen(home)+strlen(configfile)+1;
+ filename = (char*)malloc(n*sizeof(char));
+ memset(filename,0,n);
+ strcat(filename, home);
+ strcat(filename, configfile);
+
+ loadConfig(filename); /* reload the configuration file */
+
+ free(filename);
+ filename = NULL;
}
fade *