Package: consolekit Version: 0.2.3-3 Severity: wishlist Tags: patch Forwarded: https://bugs.freedesktop.org/show_bug.cgi?id=11786 User: [EMAIL PROTECTED] Usertags: origin-ubuntu intrepid ubuntu-patch
Hi, The attached patch is used in Ubuntu to fix the situation described in the above upstream bug. It's not being fixed upstream as it's going to be fixed with the new gdm. However, you may like to add the patch in the meantime. I don't think the new gdm will be in lenny, and I don't know if kdm has this problem and if so whether it has been addressed there. If you apply the patch I will see about providing the corresponding patch to gdm. Please consider applying the patch. Thanks, James
# # Upstream: https://bugs.freedesktop.org/show_bug.cgi?id=11786 # diff -Nur -x '*.orig' -x '*~' consolekit-0.2.3/data/ConsoleKit.conf consolekit-0.2.3.new/data/ConsoleKit.conf --- consolekit-0.2.3/data/ConsoleKit.conf 2007-08-29 21:55:34.000000000 +0200 +++ consolekit-0.2.3.new/data/ConsoleKit.conf 2007-12-12 17:05:31.000000000 +0100 @@ -12,6 +12,8 @@ <allow send_interface="org.freedesktop.ConsoleKit.Session"/> <allow send_interface="org.freedesktop.ConsoleKit.Manager" + send_member="SetX11ParkingPlace"/> + <allow send_interface="org.freedesktop.ConsoleKit.Manager" send_member="OpenConsoleWithParameters"/> <allow send_interface="org.freedesktop.ConsoleKit.Session" send_member="Lock"/> @@ -28,6 +30,8 @@ <allow send_interface="org.freedesktop.ConsoleKit.Session"/> <deny send_interface="org.freedesktop.ConsoleKit.Manager" + send_member="SetX11ParkingPlace"/> + <deny send_interface="org.freedesktop.ConsoleKit.Manager" send_member="OpenSessionWithParameters"/> <deny send_interface="org.freedesktop.ConsoleKit.Session" send_member="Lock"/> diff -Nur -x '*.orig' -x '*~' consolekit-0.2.3/src/ck-manager.c consolekit-0.2.3.new/src/ck-manager.c --- consolekit-0.2.3/src/ck-manager.c 2007-08-28 19:16:03.000000000 +0200 +++ consolekit-0.2.3.new/src/ck-manager.c 2007-12-12 17:05:31.000000000 +0100 @@ -28,6 +28,13 @@ #include <signal.h> #include <sys/stat.h> #include <sys/types.h> +#ifdef HAVE_PATHS_H +#include <paths.h> +#endif /* HAVE_PATHS_H */ + +#ifndef _PATH_TTY +#define _PATH_TTY "/dev/tty" +#endif #include <glib.h> #include <glib/gi18n.h> @@ -1339,6 +1346,41 @@ CkManager *manager; } RemoveLeaderData; +gboolean +ck_manager_set_x11_parking_place (CkManager *manager, + const char *x11display, + const char *x11displaydevice, + DBusGMethodInvocation *context) +{ + CkSeat *seat; + guint num; + gboolean res = FALSE; + + g_debug ("x11display=%s device=%s", x11display, x11displaydevice); + + seat = g_hash_table_lookup (manager->priv->seats, + CK_DBUS_PATH "/Seat1"); + /* FIXME: this is rather unpleasantly hardcoded, but it + * mirrors the code in find_seat_for_session - iwj */ + if (seat == NULL) { + g_debug ("no seat"); + goto xit; + } + + if (sscanf (x11displaydevice, _PATH_TTY "%u", &num) != 1) { + g_debug ("bad device"); + goto xit; + } + + ck_seat_set_park_vt (seat, num); + res = TRUE; + +xit: + dbus_g_method_return (context, res); + + return TRUE; +} + static gboolean remove_leader_for_connection (const char *cookie, LeaderInfo *info, diff -Nur -x '*.orig' -x '*~' consolekit-0.2.3/src/ck-manager.h consolekit-0.2.3.new/src/ck-manager.h --- consolekit-0.2.3/src/ck-manager.h 2007-07-10 16:15:45.000000000 +0200 +++ consolekit-0.2.3.new/src/ck-manager.h 2007-12-12 17:05:31.000000000 +0100 @@ -79,6 +79,10 @@ gboolean ck_manager_close_session (CkManager *manager, const char *cookie, DBusGMethodInvocation *context); +gboolean ck_manager_set_x11_parking_place (CkManager *manager, + const char *x11display, + const char *x11displaydevice, + DBusGMethodInvocation *context); gboolean ck_manager_get_current_session (CkManager *manager, DBusGMethodInvocation *context); gboolean ck_manager_get_session_for_cookie (CkManager *manager, diff -Nur -x '*.orig' -x '*~' consolekit-0.2.3/src/ck-manager.xml consolekit-0.2.3.new/src/ck-manager.xml --- consolekit-0.2.3/src/ck-manager.xml 2007-08-17 17:52:52.000000000 +0200 +++ consolekit-0.2.3.new/src/ck-manager.xml 2007-12-12 17:05:31.000000000 +0100 @@ -15,6 +15,11 @@ <arg name="cookie" direction="in" type="s"/> <arg name="result" direction="out" type="b"/> </method> + <method name="SetX11ParkingPlace"> + <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> + <arg name="x11display" direction="in" type="s"/> + <arg name="x11displaydevice" direction="in" type="s"/> + </method> <method name="GetSeats"> <arg name="seats" direction="out" type="ao"/> </method> diff -Nur -x '*.orig' -x '*~' consolekit-0.2.3/src/ck-seat.c consolekit-0.2.3.new/src/ck-seat.c --- consolekit-0.2.3/src/ck-seat.c 2007-08-21 17:48:38.000000000 +0200 +++ consolekit-0.2.3.new/src/ck-seat.c 2007-12-12 17:07:37.000000000 +0100 @@ -59,6 +59,8 @@ CkSession *active_session; CkVtMonitor *vt_monitor; + guint vt_park_num; + gboolean vt_park_enable; DBusGConnection *connection; }; @@ -471,9 +473,17 @@ g_object_ref (session); ck_session_get_id (session, &ssid, NULL); ck_session_set_active (session, TRUE, NULL); + g_debug ("Active session changed: %s", ssid); + } else if (seat->priv->vt_park_enable) { + ck_seat_park (seat); + g_debug ("Active session: none - parking"); + } else { + g_debug ("Active session: none and no parking"); } - g_debug ("Active session changed: %s", ssid); + /* We park only once: enable is set when a session exits + * and cleared here when we choose a new session. */ + seat->priv->vt_park_enable = FALSE; g_signal_emit (seat, signals [ACTIVE_SESSION_CHANGED], 0, ssid); @@ -522,6 +532,33 @@ return TRUE; } +void +ck_seat_park (CkSeat *seat) +{ + GError *vt_error; + guint num; + gboolean ret; + + num = seat->priv->vt_park_num; + g_debug ("Parking on VT %u", num); + if (num < 0) return; + + vt_error = NULL; + ret = ck_vt_monitor_set_active (seat->priv->vt_monitor, num, &vt_error); + if (! ret) { + g_debug ("Unable to park: %s", vt_error->message); + g_error_free (vt_error); + } +} + +void +ck_seat_set_park_vt (CkSeat *seat, guint num) +{ + g_debug ("Parking place is VT %u", num); + + seat->priv->vt_park_num = num; +} + gboolean ck_seat_remove_session (CkSeat *seat, CkSession *session, @@ -554,6 +591,7 @@ g_hash_table_remove (seat->priv->sessions, ssid); /* try to change the active session */ + seat->priv->vt_park_enable = TRUE; maybe_update_active_session (seat); ret = TRUE; @@ -945,6 +983,8 @@ g_str_equal, g_free, (GDestroyNotify) g_object_unref); + seat->priv->vt_park_num = -1; + seat->priv->vt_park_enable = FALSE; seat->priv->devices = g_ptr_array_new (); } diff -Nur -x '*.orig' -x '*~' consolekit-0.2.3/src/ck-seat.h consolekit-0.2.3.new/src/ck-seat.h --- consolekit-0.2.3/src/ck-seat.h 2007-07-20 17:02:07.000000000 +0200 +++ consolekit-0.2.3.new/src/ck-seat.h 2007-12-12 17:05:31.000000000 +0100 @@ -129,6 +129,9 @@ gboolean ck_seat_activate_session (CkSeat *seat, const char *ssid, DBusGMethodInvocation *context); +void ck_seat_park (CkSeat *seat); +void ck_seat_set_park_vt (CkSeat *seat, + guint num); G_END_DECLS