1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
Index: consolekit/src/ck-seat.c
===================================================================
--- consolekit.orig/src/ck-seat.c 2013-07-30 17:35:46.031481292 +0400
+++ consolekit/src/ck-seat.c 2013-07-30 17:35:47.628494929 +0400
@@ -962,9 +962,32 @@
ck_session_is_open (value, &is_open, NULL);
if (is_open) {
+ GError *vt_error = NULL;
+ char *device;
+ guint num;
+ gboolean ret;
+
login_session = NULL;
- change_active_session (seat, value);
- break;
+
+ g_debug ("Found open session.");
+
+ switch (seat->priv->kind) {
+ case CK_SEAT_KIND_STATIC:
+ device = NULL;
+ ck_session_get_x11_display_device (value, &device, NULL);
+
+ if (device != NULL) {
+ ret = ck_get_console_num_from_device (device, &num);
+ if (ret) {
+ g_debug ("Activating VT %d", num);
+ ck_vt_monitor_set_active (seat->priv->vt_monitor, num, &vt_error);
+ }
+ }
+ break;
+ case CK_SEAT_KIND_DYNAMIC:
+ change_active_session (seat, value);
+ break;
+ }
}
ck_session_get_session_type (value, &session_type, NULL);
@@ -1054,6 +1077,11 @@
CkSession *orig_session;
gboolean res;
gboolean ret;
+ GHashTableIter iter;
+ gpointer key, value;
+ gboolean found_login = FALSE;
+ gboolean is_open;
+ char *session_type = NULL;
g_return_val_if_fail (CK_IS_SEAT (seat), FALSE);
@@ -1093,7 +1121,46 @@
g_signal_emit (seat, signals [SESSION_REMOVED], 0, ssid);
/* try to change the active session */
- maybe_update_active_session (seat);
+
+ /* On session exit, first try to switch to any active login sessions */
+ g_hash_table_iter_init (&iter, seat->priv->sessions);
+ if (seat->priv->kind == CK_SEAT_KIND_STATIC) {
+ while (seat->priv->kind == CK_SEAT_KIND_STATIC && g_hash_table_iter_next (&iter, &key, &value)) {
+ CkSession *login_session = value;
+ ck_session_get_session_type (login_session, &session_type, NULL);
+ ck_session_is_open (login_session, &is_open, NULL);
+
+ if (is_open && IS_STR_SET (session_type) &&
+ g_str_equal (session_type, "LoginWindow")) {
+ GError *vt_error = NULL;
+ char *device;
+ guint num;
+
+ g_debug ("Found a LoginWindow");
+ device = NULL;
+ ck_session_get_x11_display_device (login_session, &device, NULL);
+
+ if (device != NULL) {
+ ret = ck_get_console_num_from_device (device, &num);
+ if (ret) {
+ g_debug ("Setting active to %d", num);
+ found_login = TRUE;
+ ck_vt_monitor_set_active (seat->priv->vt_monitor, num, &vt_error);
+ } else {
+ g_debug ("The LoginWindow device has no console number, not using.");
+ }
+ } else {
+ g_debug ("The LoginWindow display has no x11 display device, not using.");
+ }
+ }
+ if (session_type != NULL)
+ g_free (session_type);
+ }
+ }
+
+ /* Otherwise, look for an active session */
+ if (found_login == FALSE)
+ maybe_update_active_session (seat);
if (orig_session != NULL) {
g_object_unref (orig_session);
@@ -1359,8 +1426,6 @@
CkSeat *seat)
{
g_debug ("Active vt changed: %u", num);
-
- update_active_vt (seat, num);
}
gboolean
|