python/hypothesis: update to 6.121.0
[oi-userland.git] / components / library / ConsoleKit / patches / 13-vt-switch.patch
blob8baa0eff7b869289a3539f69b3783ccf53039c70
1 --- ConsoleKit-0.4.1/src/ck-seat.c-orig 2011-07-28 01:25:03.688403859 -0500
2 +++ ConsoleKit-0.4.1/src/ck-seat.c 2011-07-28 01:27:24.076536756 -0500
3 @@ -951,9 +951,32 @@ find_possible_session_to_activate (CkSea
4 ck_session_is_open (value, &is_open, NULL);
6 if (is_open) {
7 + GError *vt_error = NULL;
8 + char *device;
9 + guint num;
10 + gboolean ret;
12 login_session = NULL;
13 - change_active_session (seat, value);
14 - break;
16 + g_debug ("Found open session.");
18 + switch (seat->priv->kind) {
19 + case CK_SEAT_KIND_STATIC:
20 + device = NULL;
21 + ck_session_get_x11_display_device (value, &device, NULL);
23 + if (device != NULL) {
24 + ret = ck_get_console_num_from_device (device, &num);
25 + if (ret) {
26 + g_debug ("Activating VT %d", num);
27 + ck_vt_monitor_set_active (seat->priv->vt_monitor, num, &vt_error);
28 + }
29 + }
30 + break;
31 + case CK_SEAT_KIND_DYNAMIC:
32 + change_active_session (seat, value);
33 + break;
34 + }
37 ck_session_get_session_type (value, &session_type, NULL);
38 @@ -1037,6 +1060,11 @@ ck_seat_remove_session (CkSeat *
39 CkSession *orig_session;
40 gboolean res;
41 gboolean ret;
42 + GHashTableIter iter;
43 + gpointer key, value;
44 + gboolean found_login = FALSE;
45 + gboolean is_open;
46 + char *session_type = NULL;
48 g_return_val_if_fail (CK_IS_SEAT (seat), FALSE);
50 @@ -1076,7 +1104,48 @@ ck_seat_remove_session (CkSeat *
51 g_signal_emit (seat, signals [SESSION_REMOVED], 0, ssid);
53 /* try to change the active session */
54 - maybe_update_active_session (seat);
56 + /* On session exit, first try to switch to any active login sessions */
57 + g_hash_table_iter_init (&iter, seat->priv->sessions);
58 + if (seat->priv->kind == CK_SEAT_KIND_STATIC) {
59 + while (seat->priv->kind == CK_SEAT_KIND_STATIC && g_hash_table_iter_next (&iter, &key, &value)) {
60 + CkSession *login_session = value;
61 + ck_session_get_session_type (login_session, &session_type, NULL);
62 + ck_session_is_open (login_session, &is_open, NULL);
64 + if (is_open && IS_STR_SET (session_type) &&
65 + g_str_equal (session_type, "LoginWindow")) {
66 + GError *vt_error = NULL;
67 + char *device;
68 + guint num;
70 + g_debug ("Found a LoginWindow");
71 + device = NULL;
72 + ck_session_get_x11_display_device (login_session, &device, NULL);
74 + if (device != NULL) {
75 + ret = ck_get_console_num_from_device (device, &num);
76 + if (ret) {
77 + g_debug ("Setting active to %d", num);
78 + found_login = TRUE;
79 + ck_vt_monitor_set_active (seat->priv->vt_monitor, num, &vt_error);
80 + } else {
81 + g_debug ("The LoginWindow device has no console number, not using.");
82 + }
83 + } else {
84 + g_debug ("The LoginWindow display has no x11 display device, not using.");
85 + }
86 + }
87 + if (session_type != NULL)
88 + g_free (session_type);
89 + }
90 + }
92 + /* Otherwise, look for an active session */
93 + if (found_login == FALSE) {
94 + g_debug ("Login not found. Maybe update active session");
95 + maybe_update_active_session (seat);
96 + }
98 if (orig_session != NULL) {
99 g_object_unref (orig_session);
100 @@ -1345,8 +1412,6 @@ active_vt_changed (CkVtMonitor *vt_mo
101 CkSeat *seat)
103 g_debug ("Active vt changed: %u", num);
105 - update_active_vt (seat, num);
108 gboolean