summaryrefslogtreecommitdiffstats
path: root/src/ck-seat.c
diff options
context:
space:
mode:
authorWilliam Jon McCann <mccann@jhu.edu>2007-02-12 16:15:51 -0500
committerWilliam Jon McCann <mccann@jhu.edu>2007-02-12 16:15:51 -0500
commit3444585150a2f88ccfe92ba5f3959961428d597c (patch)
tree99a86bb3666e5a0f43503d8bab12542aed4b208c /src/ck-seat.c
parentdc427221e1c5028465f4a78132374662341ca3b7 (diff)
use the supplied vt number when updating active session
Just the use vt number given by the vt-manager instead of asking for the current vt again. A little bit less racy this way.
Diffstat (limited to 'src/ck-seat.c')
-rw-r--r--src/ck-seat.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/ck-seat.c b/src/ck-seat.c
index a0e6d09..0d56416 100644
--- a/src/ck-seat.c
+++ b/src/ck-seat.c
@@ -339,6 +339,23 @@ change_active_session (CkSeat *seat,
}
static void
+update_active_vt (CkSeat *seat,
+ guint num)
+{
+ CkSession *session;
+ char *device;
+
+ device = g_strdup_printf ("/dev/tty%u", num);
+
+ ck_debug ("Active device: %s", device);
+
+ session = find_session_for_display_device (seat, device);
+ change_active_session (seat, session);
+
+ g_free (device);
+}
+
+static void
maybe_update_active_session (CkSeat *seat)
{
guint num;
@@ -348,17 +365,7 @@ maybe_update_active_session (CkSeat *seat)
}
if (ck_vt_monitor_get_active (seat->priv->vt_monitor, &num, NULL)) {
- CkSession *session;
- char *device;
-
- device = g_strdup_printf ("/dev/tty%u", num);
-
- ck_debug ("Active device: %s", device);
-
- session = find_session_for_display_device (seat, device);
- change_active_session (seat, session);
-
- g_free (device);
+ update_active_vt (seat, num);
}
}
@@ -476,7 +483,7 @@ active_vt_changed (CkVtMonitor *vt_monitor,
{
ck_debug ("Active vt changed: %u", num);
- maybe_update_active_session (seat);
+ update_active_vt (seat, num);
}
static gboolean