mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
backends/native: Set headless mode when no seat_id
This forces not using the seat_proxy. But still allows the use of session_proxy. On tests, headless mode is explicitly set and it might not be available a systemd session. To avoid test failing on this situation skip using meta_launcher wich uses session_proxy and seat_proxy. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3093>
This commit is contained in:
parent
f0bb540797
commit
adf12504c0
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user