diff options
author | William Jon McCann <mccann@jhu.edu> | 2007-02-12 16:15:51 -0500 |
---|---|---|
committer | William Jon McCann <mccann@jhu.edu> | 2007-02-12 16:15:51 -0500 |
commit | 3444585150a2f88ccfe92ba5f3959961428d597c (patch) | |
tree | 99a86bb3666e5a0f43503d8bab12542aed4b208c /src | |
parent | dc427221e1c5028465f4a78132374662341ca3b7 (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')
-rw-r--r-- | src/ck-seat.c | 31 |
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 |