]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
And allow duplicate types in type field
authorMichael Terry <michael.terry@canonical.com>
Mon, 25 Nov 2013 21:38:53 +0000 (16:38 -0500)
committerMichael Terry <michael.terry@canonical.com>
Mon, 25 Nov 2013 21:38:53 +0000 (16:38 -0500)
src/lightdm.c
src/seat.c
src/seat.h
tests/scripts/unity-compositor-fallback.conf

index bf9f72e1469d1fbdb7f8f6d34245d2073527f920..22da44e513bba46f81b15d12c0c4dad3fed3a732 100644 (file)
@@ -184,25 +184,30 @@ display_manager_stopped_cb (DisplayManager *display_manager)
 static void
 display_manager_seat_removed_cb (DisplayManager *display_manager, Seat *seat)
 {
-    const gchar *type;
     gchar **types;
     gchar **iter;
-    gboolean make_seats = FALSE;
     Seat *next_seat = NULL;
+    GString *next_types;
 
     /* If we have fallback types registered for the seat, let's try them
-       before giving up.  This code does not expect a type name to appear twice
-       in the type list.  It is a configuration error to do so. */
-    type = seat_get_type_name (seat);
+       before giving up. */
     types = seat_get_string_list_property (seat, "type");
+    next_types = g_string_new ("");
     for (iter = types; iter && *iter; iter++)
     {
-        if (g_strcmp0 (type, *iter) == 0)
-            make_seats = TRUE;
-        else if (make_seats) {
+        if (iter == types)
+            continue; // skip first one, that is our current seat type
+
+        if (!next_seat)
+        {
             next_seat = seat_new (*iter);
-            if (next_seat)
-                break;
+            g_string_assign (next_types, *iter);
+        }
+        else
+        {
+            // Build up list of types to try next time
+            g_string_append_c (next_types, ';');
+            g_string_append (next_types, *iter);
         }
     }
     g_strfreev (types);
@@ -222,6 +227,9 @@ display_manager_seat_removed_cb (DisplayManager *display_manager, Seat *seat)
         if (seat_get_boolean_property (seat, "exit-on-failure"))
             seat_set_property (next_seat, "exit-on-failure", "true");
 
+        seat_set_property (next_seat, "type", next_types->str);
+        g_string_free (next_types, TRUE);
+
         display_manager_add_seat (display_manager, next_seat);
         g_object_unref (next_seat);
     }
index 772c5620a06be90590152cb3678de5ad737cd483..5c7f8a8303152f371f5470f4469876135121c47f 100644 (file)
@@ -121,30 +121,6 @@ seat_new (const gchar *module_name)
     return seat;
 }
 
-const gchar *
-seat_get_type_name (Seat *seat)
-{
-    GList *values = NULL;
-    GList *iter;
-    const gchar *name = NULL;
-
-    if (seat_modules)
-        values = g_hash_table_get_values (seat_modules);
-
-    for (iter = values; iter; iter = iter->next)
-    {
-        SeatModule *module = (SeatModule *)iter->data;
-        if (module->type == G_OBJECT_TYPE (seat))
-        {
-            name = module->name;
-            break;
-        }
-    }
-
-    g_list_free (values);
-    return name;
-}
-
 void
 seat_set_property (Seat *seat, const gchar *name, const gchar *value)
 {
index 5bde5c2066b764bb0432fdfef04c5c40f715ecdc..f6502ea7d5dfc09ce52365d25c72a7d419f3c973 100644 (file)
@@ -63,8 +63,6 @@ void seat_register_module (const gchar *name, GType type);
 
 Seat *seat_new (const gchar *module_name);
 
-const gchar *seat_get_type_name (Seat *seat);
-
 void seat_set_property (Seat *seat, const gchar *name, const gchar *value);
 
 const gchar *seat_get_string_property (Seat *seat, const gchar *name);
index ba4261d3fc6a26d0d83c60a80b780885d347e3cf..a87539326312151ea9d264c43624d13652ef730c 100644 (file)
@@ -6,7 +6,7 @@
 return-value=1
 
 [SeatDefaults]
-type=unity;xlocal;
+type=unity;INVALID;unity;xlocal;
 
 #?RUNNER DAEMON-START
 
@@ -14,6 +14,10 @@ type=unity;xlocal;
 #?UNITY-SYSTEM-COMPOSITOR START VT=7 XDG_VTNR=7
 #?UNITY-SYSTEM-COMPOSITOR EXIT CODE=1
 
+# System compositor fails to start a second time
+#?UNITY-SYSTEM-COMPOSITOR START VT=7 XDG_VTNR=7
+#?UNITY-SYSTEM-COMPOSITOR EXIT CODE=1
+
 # X server starts in VT mode
 #?XSERVER-0 START VT=7