diff options
Diffstat (limited to 'x11-misc/slim/files/slim-1.3.2-ck.patch')
-rw-r--r-- | x11-misc/slim/files/slim-1.3.2-ck.patch | 186 |
1 files changed, 186 insertions, 0 deletions
diff --git a/x11-misc/slim/files/slim-1.3.2-ck.patch b/x11-misc/slim/files/slim-1.3.2-ck.patch new file mode 100644 index 000000000000..b5f4aa517ff2 --- /dev/null +++ b/x11-misc/slim/files/slim-1.3.2-ck.patch @@ -0,0 +1,186 @@ +diff -Naur slim-1.3.2/app.cpp slim-1.3.2.new/app.cpp +--- slim-1.3.2/app.cpp 2011-12-14 14:33:45.000000000 -0500 ++++ slim-1.3.2.new/app.cpp 2011-12-14 13:25:19.000000000 -0500 +@@ -536,6 +536,60 @@ + string xauthority = pw->pw_dir; + xauthority.append("/.Xauthority"); + ++#ifdef USE_CONSOLEKIT ++ cerr << APPNAME << ": consolekit support enabled" << endl; ++ int ret; ++ DBusError error; ++ char *remote_host_name = ""; ++ dbus_bool_t is_local; ++ char *display_device = ""; ++ //char devtmp[16]; ++ ++ // if (!use_consolekit) return 1; ++ cerr << APPNAME << ": initializing a consolekit session" << endl; ++ ++ is_local = TRUE; //is_local = Dpy->displayType.location == Local; ++ //if (Dpy->peerlen > 0 && Dpy->peer) ++ //remote_host_name = Dpy->peer; ++ /* how can we get the corresponding tty at best...? */ ++// if (Dpy->windowPath) { ++// display_device = strchr(Dpy->windowPath, ':'); ++// if (display_device && display_device[1]) ++// display_device++; ++// else ++// display_device = Dpy->windowPath; ++// snprintf(devtmp, sizeof(devtmp), "/dev/tty%s", display_device); ++// display_device = devtmp; ++display_device = dpy_tty; // } ++ ++ ckconnector = ck_connector_new(); ++ if (!ckconnector) { ++ cerr << APPNAME << ": ck_connector not initialized" << endl; ++ //return 0; ++ } ++ ++ dbus_error_init(&error); ++ ret = ck_connector_open_session_with_parameters( ++ ckconnector, &error, ++ "unix-user", &pw->pw_uid, ++ "x11-display", &DisplayName, ++ "x11-display-device", &display_device, ++ "remote-host-name", &remote_host_name, ++ "is-local", &is_local, ++ NULL); ++ if (!ret) { ++ if (dbus_error_is_set(&error)) { ++ cerr << APPNAME << ": Dbus error: " << error.message << endl; ++ dbus_error_free(&error); ++ } else { ++ cerr << APPNAME << ": ConsoleKit error" << endl; ++ } ++ cerr << APPNAME << ": console-kit-daemon not running?" << endl; ++ ck_connector_unref(ckconnector); ++ ckconnector = NULL; ++ } ++#endif ++ + #ifdef USE_PAM + // Setup the PAM environment + try{ +@@ -548,6 +602,8 @@ + pam.setenv("DISPLAY", DisplayName); + pam.setenv("MAIL", maildir.c_str()); + pam.setenv("XAUTHORITY", xauthority.c_str()); ++ pam.setenv("XDG_SESSION_COOKIE", ck_connector_get_cookie(ckconnector)); ++ cerr << APPNAME << ": ck_connector has XDG_SESSION_COOKIE of " << ck_connector_get_cookie(ckconnector) << endl; + } + catch(PAM::Exception& e){ + cerr << APPNAME << ": " << e << endl; +@@ -564,7 +620,11 @@ + char** child_env = pam.getenvlist(); + pam.end(); + #else ++#if USE_CONSOLEKIT ++ const int Num_Of_Variables = 11; // Number of env. variables + 1 ++#else + const int Num_Of_Variables = 10; // Number of env. variables + 1 ++#endif + char** child_env = static_cast<char**>(malloc(sizeof(char*)*Num_Of_Variables)); + int n = 0; + if(term) child_env[n++]=StrConcat("TERM=", term); +@@ -576,6 +636,10 @@ + child_env[n++]=StrConcat("DISPLAY=", DisplayName); + child_env[n++]=StrConcat("MAIL=", maildir.c_str()); + child_env[n++]=StrConcat("XAUTHORITY=", xauthority.c_str()); ++#if USE_CONSOLEKIT ++ child_env[n++]=StrConcat("XDG_SESSION_COOKIE=", ck_connector_get_cookie(ckconnector)); ++ cerr << APPNAME << ": ck_connector has XDG_SESSION_COOKIE of " << ck_connector_get_cookie(ckconnector) << endl; ++#endif + child_env[n++]=0; + #endif + +@@ -617,6 +681,28 @@ + } + } + ++#ifdef USE_CONSOLEKIT ++ ++ //DBusError error; ++ ++ // if (!ckconnector) ++ //return; ++ ++ //dbus_error_init(&error); ++ if (!ck_connector_close_session(ckconnector, &error)) { ++ if (dbus_error_is_set(&error)) { ++ cerr << APPNAME << ": Dbus error: " << error.message << endl; ++ dbus_error_free(&error); ++ } else { ++ cerr << APPNAME << ": ConsoleKit close error" << endl; ++ } ++ cerr << APPNAME << ": console-kit-daemon not running?" << endl; ++ } ++ ck_connector_unref(ckconnector); ++ ckconnector = NULL; ++ //} ++#endif ++ + #ifdef USE_PAM + try{ + pam.close_session(); +@@ -881,12 +967,18 @@ + bool ok = false; + Cfg::string2int(server[i]+2, &ok); + if (ok) { ++#ifdef USE_CONSOLEKIT ++ sprintf(dpy_tty,"/dev/tty%d",atoi(server[i]+2)); ++#endif + hasVtSet = true; + } + } + } + + if (!hasVtSet && daemonmode) { ++#ifdef USE_CONSOLEKIT ++ sprintf(dpy_tty,"/dev/tty7"); ++#endif + server[argc++] = (char*)"vt07"; + } + server[argc] = NULL; +diff -Naur slim-1.3.2/app.h slim-1.3.2.new/app.h +--- slim-1.3.2/app.h 2011-12-14 14:33:45.000000000 -0500 ++++ slim-1.3.2.new/app.h 2011-12-14 11:51:39.000000000 -0500 +@@ -27,6 +27,10 @@ + #ifdef USE_PAM + #include "PAM.h" + #endif ++#ifdef USE_CONSOLEKIT ++#include <ck-connector.h> ++#include <dbus/dbus.h> ++#endif + + class App { + public: +@@ -81,6 +85,12 @@ + #ifdef USE_PAM + PAM::Authenticator pam; + #endif ++#ifdef USE_CONSOLEKIT ++ CkConnector *ckconnector; ++ int use_consolekit; ++ char dpy_tty[16]; ++#endif ++ + + // Options + char* DispName; +diff -Naur slim-1.3.2/Makefile slim-1.3.2.new/Makefile +--- slim-1.3.2/Makefile 2011-12-14 14:33:45.000000000 -0500 ++++ slim-1.3.2.new/Makefile 2011-12-14 11:43:02.000000000 -0500 +@@ -13,6 +13,11 @@ + LDFLAGS+= -lpam + CUSTOM+= -DUSE_PAM + endif ++ifdef USE_CONSOLEKIT ++LDFLAGS+= `pkg-config --libs ck-connector` ++CFLAGS+= `pkg-config --cflags ck-connector` ++CUSTOM+= -DUSE_CONSOLEKIT ++endif + PREFIX=/usr + CFGDIR=/etc + MANDIR=/usr/share/man |