diff -ru orig/consolekit-0.2.1/data/ConsoleKit.conf consolekit-0.2.1/data/ConsoleKit.conf --- orig/consolekit-0.2.1/data/ConsoleKit.conf 2007-03-09 18:13:52.000000000 +0000 +++ consolekit-0.2.1/data/ConsoleKit.conf 2007-07-31 19:39:00.000000000 +0100 @@ -12,6 +12,8 @@ + @@ -28,6 +30,8 @@ + @@ -43,6 +47,8 @@ + Only in consolekit-0.2.1/data: ConsoleKit.conf~ diff -ru orig/consolekit-0.2.1/src/ck-manager.c consolekit-0.2.1/src/ck-manager.c --- orig/consolekit-0.2.1/src/ck-manager.c 2007-04-04 16:50:26.000000000 +0100 +++ consolekit-0.2.1/src/ck-manager.c 2007-07-31 19:32:12.000000000 +0100 @@ -28,6 +28,13 @@ #include #include #include +#ifdef HAVE_PATHS_H +#include +#endif /* HAVE_PATHS_H */ + +#ifndef _PATH_TTY +#define _PATH_TTY "/dev/tty" +#endif #include #include @@ -1337,6 +1344,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, Only in consolekit-0.2.1/src: ck-manager.c~ diff -ru orig/consolekit-0.2.1/src/ck-manager.h consolekit-0.2.1/src/ck-manager.h --- orig/consolekit-0.2.1/src/ck-manager.h 2007-04-04 16:54:15.000000000 +0100 +++ consolekit-0.2.1/src/ck-manager.h 2007-07-31 18:22:45.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, Only in consolekit-0.2.1/src: ck-manager.h~ diff -ru orig/consolekit-0.2.1/src/ck-manager.xml consolekit-0.2.1/src/ck-manager.xml --- orig/consolekit-0.2.1/src/ck-manager.xml 2007-03-19 16:25:57.000000000 +0000 +++ consolekit-0.2.1/src/ck-manager.xml 2007-07-31 18:19:48.000000000 +0100 @@ -15,6 +15,11 @@ + + + + + Only in consolekit-0.2.1/src: ck-manager.xml~ diff -ru orig/consolekit-0.2.1/src/ck-seat.c consolekit-0.2.1/src/ck-seat.c --- orig/consolekit-0.2.1/src/ck-seat.c 2007-04-03 16:32:56.000000000 +0100 +++ consolekit-0.2.1/src/ck-seat.c 2007-07-31 18:24:12.000000000 +0100 @@ -62,6 +62,7 @@ CkSession *active_session; CkVtMonitor *vt_monitor; + guint vt_park_num; DBusGConnection *connection; }; @@ -470,9 +471,11 @@ 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); + g_debug ("Active session changed: %s", ssid); + } else { + ck_seat_park (seat); + g_debug ("Active session: none - parking"); + } g_signal_emit (seat, signals [ACTIVE_SESSION_CHANGED], 0, ssid); @@ -521,6 +524,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, @@ -839,6 +869,7 @@ g_str_equal, g_free, (GDestroyNotify) g_object_unref); + seat->priv->vt_park_num = -1; } static void Only in consolekit-0.2.1/src: ck-seat.c~ diff -ru orig/consolekit-0.2.1/src/ck-seat.h consolekit-0.2.1/src/ck-seat.h --- orig/consolekit-0.2.1/src/ck-seat.h 2007-03-19 16:23:12.000000000 +0000 +++ consolekit-0.2.1/src/ck-seat.h 2007-07-31 18:18:04.000000000 +0100 @@ -105,6 +105,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 Only in consolekit-0.2.1/src: ck-seat.h~ Only in consolekit-0.2.1/src: ck-vt-monitor.c~