diff -u -r ConsoleKit-0.3.0/src/ck-sysdeps-unix.c patched-ConsoleKit-0.3.0/src/ck-sysdeps-unix.c --- ConsoleKit-0.3.0/src/ck-sysdeps-unix.c 2008-01-23 09:30:44.000000000 -0500 +++ patched-ConsoleKit-0.3.0/src/ck-sysdeps-unix.c 2009-03-24 16:31:56.000000000 -0400 @@ -53,6 +53,8 @@ #define ERROR -1 #endif +#define VT_WAITSWITCH 0x560E + /* Adapted from dbus-sysdeps-unix.c:_dbus_read_credentials_socket() */ gboolean ck_get_socket_peer_credentials (int socket_fd, @@ -262,9 +264,9 @@ errno = 0; #ifdef VT_WAITACTIVE - g_debug ("VT_WAITACTIVE for vt %d", num); - res = ioctl (console_fd, VT_WAITACTIVE, num); - g_debug ("VT_WAITACTIVE for vt %d returned %d", num, res); + g_debug ("VT_WAITSWITCH"); + res = ioctl (console_fd, VT_WAITSWITCH); + g_debug ("VT_WAITSWITCH for vt returned %d", res); #else res = ERROR; errno = ENOTSUP; diff -u -r ConsoleKit-0.3.0/src/ck-vt-monitor.c patched-ConsoleKit-0.3.0/src/ck-vt-monitor.c --- ConsoleKit-0.3.0/src/ck-vt-monitor.c 2008-04-19 00:42:26.000000000 -0400 +++ patched-ConsoleKit-0.3.0/src/ck-vt-monitor.c 2009-03-24 16:32:23.000000000 -0400 @@ -40,8 +40,9 @@ #include "ck-sysdeps.h" #include "ck-marshal.h" -#if defined (__sun) && defined (HAVE_SYS_VT_H) #include + +#if defined (__sun) && defined (HAVE_SYS_VT_H) #include #include #endif @@ -163,7 +164,6 @@ return TRUE; } -#if defined (__sun) && defined (HAVE_SYS_VT_H) static void handle_vt_active (void) { @@ -199,7 +199,6 @@ g_debug ("VT activated but already active: %d", num); } } -#endif static void change_active_num (CkVtMonitor *vt_monitor, @@ -318,10 +317,17 @@ vt_monitor = data->vt_monitor; num = data->num; + g_return_val_if_fail (CK_IS_VT_MONITOR (vt_monitor), (void*)0); + +again: res = ck_wait_for_active_console_num (vt_monitor->priv->vfd, num); if (! res) { /* FIXME: what do we do if it fails? */ } else { +#if 1 + handle_vt_active(); + goto again; +#else EventData *event; /* add event to queue */ @@ -333,6 +339,7 @@ /* schedule processing of queue */ schedule_process_queue (vt_monitor); +#endif } G_LOCK (hash_lock); @@ -407,7 +414,7 @@ /* FIXME: this can fail on solaris and freebsd */ } - for (i = 1; i < max_consoles; i++) { + for (i = 1; i <= 1; i++) { gpointer id; /* don't wait on the active vc */