diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c index 9e8c918d4..f01890460 100644 --- a/src/backends/native/meta-backend-native.c +++ b/src/backends/native/meta-backend-native.c @@ -775,30 +775,34 @@ meta_backend_native_initable_init (GInitable *initable, MetaBackendNative *native = META_BACKEND_NATIVE (initable); MetaBackend *backend = META_BACKEND (native); MetaKmsFlags kms_flags; + const char *session_id = NULL; + const char *seat_id = NULL; - if (!meta_backend_is_headless (backend)) + switch (native->mode) { - const char *session_id = NULL; - const char *seat_id = NULL; - - switch (native->mode) - { - case META_BACKEND_NATIVE_MODE_DEFAULT: - break; - case META_BACKEND_NATIVE_MODE_HEADLESS: - g_assert_not_reached (); - break; - case META_BACKEND_NATIVE_MODE_TEST: - session_id = "dummy"; - seat_id = "seat0"; - break; - } + case META_BACKEND_NATIVE_MODE_DEFAULT: + break; + case META_BACKEND_NATIVE_MODE_HEADLESS: + break; + case META_BACKEND_NATIVE_MODE_TEST: + session_id = "dummy"; + seat_id = "seat0"; + break; + } + if (native->mode != META_BACKEND_NATIVE_MODE_HEADLESS) + { native->launcher = meta_launcher_new (backend, session_id, seat_id, error); if (!native->launcher) return FALSE; + + if (!meta_launcher_get_seat_id (native->launcher)) + { + native->mode = META_BACKEND_NATIVE_MODE_HEADLESS; + g_message ("No seat assigned, running headlessly"); + } } native->device_pool = meta_device_pool_new (native); diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c index 4bc42cea4..e1c9e8e1a 100644 --- a/src/backends/native/meta-launcher.c +++ b/src/backends/native/meta-launcher.c @@ -409,29 +409,30 @@ meta_launcher_new (MetaBackend *backend, g_clear_error (&local_error); seat_id = g_strdup (fallback_seat_id); } - else - { - g_propagate_error (error, local_error); - goto fail; - } } - seat_proxy = get_seat_proxy (seat_id, NULL, error); - if (!seat_proxy) - goto fail; + if (seat_id) + { + seat_proxy = get_seat_proxy (seat_id, NULL, error); + if (!seat_proxy) + goto fail; + } self = g_new0 (MetaLauncher, 1); self->backend = backend; self->session_proxy = g_object_ref (session_proxy); - self->seat_proxy = g_object_ref (seat_proxy); - self->seat_id = g_steal_pointer (&seat_id); self->session_active = TRUE; + if (seat_id) + { + self->seat_proxy = g_object_ref (seat_proxy); + self->seat_id = g_steal_pointer (&seat_id); + } g_signal_connect (self->session_proxy, "notify::active", G_CALLBACK (on_active_changed), self); return self; - fail: +fail: if (have_control) { meta_dbus_login1_session_call_release_control_sync (session_proxy, @@ -454,6 +455,8 @@ meta_launcher_activate_vt (MetaLauncher *launcher, signed char vt, GError **error) { + g_assert (launcher->seat_proxy); + return meta_dbus_login1_seat_call_switch_to_sync (launcher->seat_proxy, vt, NULL, error); }