aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcus <marcus@FreeBSD.org>2010-07-24 10:14:15 +0800
committermarcus <marcus@FreeBSD.org>2010-07-24 10:14:15 +0800
commitf3259ae75c4e75f962abb210d16106551ae5111f (patch)
tree9cbba88031fdb1b1ee808352002ca12171fac2e4
parent82db163bec04202e062102db271a994e993a2148 (diff)
downloadfreebsd-ports-gnome-f3259ae75c4e75f962abb210d16106551ae5111f.tar.gz
freebsd-ports-gnome-f3259ae75c4e75f962abb210d16106551ae5111f.tar.zst
freebsd-ports-gnome-f3259ae75c4e75f962abb210d16106551ae5111f.zip
Allow ConsoleKit to mark X sessions started with startx as active. This
will fix a lot of problems with delays starting GNOME applications, permission problems mounting removable media, and problems not being able to shutdown or reboot. Reported by: many
-rw-r--r--sysutils/consolekit/Makefile2
-rw-r--r--sysutils/consolekit/files/ck-get-x11-display-device12
-rw-r--r--sysutils/consolekit/files/patch-tools_ck-collect-session-info.c75
3 files changed, 85 insertions, 4 deletions
diff --git a/sysutils/consolekit/Makefile b/sysutils/consolekit/Makefile
index 1742db0deb34..4fa1497a32e1 100644
--- a/sysutils/consolekit/Makefile
+++ b/sysutils/consolekit/Makefile
@@ -7,7 +7,7 @@
PORTNAME= consolekit
PORTVERSION= 0.4.1
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= sysutils gnome
MASTER_SITES= http://www.freedesktop.org/software/ConsoleKit/dist/
DISTFILES= ConsoleKit-${PORTVERSION}${EXTRACT_SUFX}
diff --git a/sysutils/consolekit/files/ck-get-x11-display-device b/sysutils/consolekit/files/ck-get-x11-display-device
index 6fc508360b92..7efc08471660 100644
--- a/sysutils/consolekit/files/ck-get-x11-display-device
+++ b/sysutils/consolekit/files/ck-get-x11-display-device
@@ -5,7 +5,6 @@ GREP="/usr/bin/grep"
AWK="/usr/bin/awk"
SED="/usr/bin/sed"
CAT="/bin/cat"
-HEAD="/usr/bin/head"
dispnum=0
if [ x"$1" = x"--display" ]; then
@@ -25,11 +24,18 @@ if [ ! -f "/tmp/.X${dispnum}-lock" ]; then
fi
pid=$(${CAT} "/tmp/.X${dispnum}-lock")
-device=$(${FSTAT} -p ${pid} | ${GREP} ttyv | ${HEAD} -1 | ${AWK} '{print $8}')
+device=$(${FSTAT} -p ${pid} | ${GREP} ttyv | ${AWK} '{print $8}')
if [ -z "${device}" ]; then
echo "ERROR: Failed to find TTY device for X server on display ${dispnum}"
exit 1
fi
-echo "/dev/${device}"
+ret=""
+for dev in ${device}; do
+ if [ "${dev}" \> "${ret}" ]; then
+ ret=${dev}
+ fi
+done
+
+echo "/dev/${dev}"
diff --git a/sysutils/consolekit/files/patch-tools_ck-collect-session-info.c b/sysutils/consolekit/files/patch-tools_ck-collect-session-info.c
new file mode 100644
index 000000000000..36714d0c503c
--- /dev/null
+++ b/sysutils/consolekit/files/patch-tools_ck-collect-session-info.c
@@ -0,0 +1,75 @@
+--- tools/ck-collect-session-info.c.orig 2009-04-29 15:07:29.000000000 -0400
++++ tools/ck-collect-session-info.c 2010-07-12 23:55:13.000000000 -0400
+@@ -226,6 +226,12 @@ fill_x11_info (SessionInfo *si)
+ gboolean res;
+ CkProcessStat *xorg_stat;
+ GError *error;
++ char *err;
++ char *out;
++ int status;
++ int i;
++ char *argv[4];
++ GPtrArray *env;
+
+ /* assume this is true then check it */
+ si->x11_display = ck_unix_pid_get_env (si->pid, "DISPLAY");
+@@ -272,6 +278,52 @@ fill_x11_info (SessionInfo *si)
+ }
+
+ si->x11_display_device = ck_process_stat_get_tty (xorg_stat);
++ if (g_strcmp0 (si->x11_display_device, si->display_device) != 0) {
++ goto gotit;
++ }
++
++ g_free (si->x11_display_device);
++
++ /* get the applicable environment */
++ env = get_filtered_environment (si->pid);
++
++ argv[0] = LIBEXECDIR "/ck-get-x11-display-device";
++ argv[1] = NULL;
++
++ error = NULL;
++ out = NULL;
++ err = NULL;
++ status = -1;
++ res = g_spawn_sync (NULL,
++ argv,
++ (char **)env->pdata,
++ 0,
++ (GSpawnChildSetupFunc)setuid_child_setup_func,
++ si,
++ &out,
++ &err,
++ &status,
++ &error);
++ for (i = 0; i < env->len; i++) {
++ g_free (g_ptr_array_index (env, i));
++ }
++ g_ptr_array_free (env, TRUE);
++
++ if (error != NULL) {
++ g_warning ("Unable to get display device for x11 server: %s", error->message);
++ g_error_free (error);
++ }
++
++ if (status == 0) {
++ if (res && out != NULL) {
++ si->x11_display_device = g_strstrip (out);
++ goto gotit;
++ }
++ }
++
++ si->x11_display_device = ck_process_stat_get_tty (xorg_stat);
++
++gotit:
+ ck_process_stat_free (xorg_stat);
+
+ si->is_local = TRUE;
+@@ -410,5 +462,5 @@ main (int argc,
+
+ ret = collect_session_info (user_id, process_id);
+
+- return ret != TRUE;
++ return ret != TRUE;
+ }