mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -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,9 +775,6 @@ meta_backend_native_initable_init (GInitable *initable,
|
|||||||
MetaBackendNative *native = META_BACKEND_NATIVE (initable);
|
MetaBackendNative *native = META_BACKEND_NATIVE (initable);
|
||||||
MetaBackend *backend = META_BACKEND (native);
|
MetaBackend *backend = META_BACKEND (native);
|
||||||
MetaKmsFlags kms_flags;
|
MetaKmsFlags kms_flags;
|
||||||
|
|
||||||
if (!meta_backend_is_headless (backend))
|
|
||||||
{
|
|
||||||
const char *session_id = NULL;
|
const char *session_id = NULL;
|
||||||
const char *seat_id = NULL;
|
const char *seat_id = NULL;
|
||||||
|
|
||||||
@ -786,7 +783,6 @@ meta_backend_native_initable_init (GInitable *initable,
|
|||||||
case META_BACKEND_NATIVE_MODE_DEFAULT:
|
case META_BACKEND_NATIVE_MODE_DEFAULT:
|
||||||
break;
|
break;
|
||||||
case META_BACKEND_NATIVE_MODE_HEADLESS:
|
case META_BACKEND_NATIVE_MODE_HEADLESS:
|
||||||
g_assert_not_reached ();
|
|
||||||
break;
|
break;
|
||||||
case META_BACKEND_NATIVE_MODE_TEST:
|
case META_BACKEND_NATIVE_MODE_TEST:
|
||||||
session_id = "dummy";
|
session_id = "dummy";
|
||||||
@ -794,11 +790,19 @@ meta_backend_native_initable_init (GInitable *initable,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (native->mode != META_BACKEND_NATIVE_MODE_HEADLESS)
|
||||||
|
{
|
||||||
native->launcher = meta_launcher_new (backend,
|
native->launcher = meta_launcher_new (backend,
|
||||||
session_id, seat_id,
|
session_id, seat_id,
|
||||||
error);
|
error);
|
||||||
if (!native->launcher)
|
if (!native->launcher)
|
||||||
return FALSE;
|
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);
|
native->device_pool = meta_device_pool_new (native);
|
||||||
|
@ -409,29 +409,30 @@ meta_launcher_new (MetaBackend *backend,
|
|||||||
g_clear_error (&local_error);
|
g_clear_error (&local_error);
|
||||||
seat_id = g_strdup (fallback_seat_id);
|
seat_id = g_strdup (fallback_seat_id);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
g_propagate_error (error, local_error);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (seat_id)
|
||||||
|
{
|
||||||
seat_proxy = get_seat_proxy (seat_id, NULL, error);
|
seat_proxy = get_seat_proxy (seat_id, NULL, error);
|
||||||
if (!seat_proxy)
|
if (!seat_proxy)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
self = g_new0 (MetaLauncher, 1);
|
self = g_new0 (MetaLauncher, 1);
|
||||||
self->backend = backend;
|
self->backend = backend;
|
||||||
self->session_proxy = g_object_ref (session_proxy);
|
self->session_proxy = g_object_ref (session_proxy);
|
||||||
|
self->session_active = TRUE;
|
||||||
|
if (seat_id)
|
||||||
|
{
|
||||||
self->seat_proxy = g_object_ref (seat_proxy);
|
self->seat_proxy = g_object_ref (seat_proxy);
|
||||||
self->seat_id = g_steal_pointer (&seat_id);
|
self->seat_id = g_steal_pointer (&seat_id);
|
||||||
self->session_active = TRUE;
|
}
|
||||||
|
|
||||||
g_signal_connect (self->session_proxy, "notify::active", G_CALLBACK (on_active_changed), self);
|
g_signal_connect (self->session_proxy, "notify::active", G_CALLBACK (on_active_changed), self);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (have_control)
|
if (have_control)
|
||||||
{
|
{
|
||||||
meta_dbus_login1_session_call_release_control_sync (session_proxy,
|
meta_dbus_login1_session_call_release_control_sync (session_proxy,
|
||||||
@ -454,6 +455,8 @@ meta_launcher_activate_vt (MetaLauncher *launcher,
|
|||||||
signed char vt,
|
signed char vt,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
g_assert (launcher->seat_proxy);
|
||||||
|
|
||||||
return meta_dbus_login1_seat_call_switch_to_sync (launcher->seat_proxy, vt,
|
return meta_dbus_login1_seat_call_switch_to_sync (launcher->seat_proxy, vt,
|
||||||
NULL, error);
|
NULL, error);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user