mirror of
https://github.com/brl/mutter.git
synced 2025-01-23 18:09:10 +00:00
backend/native: Hook up 'headless' mode to input and KMS subsystems
With this commit, it's possible to run mutter without being DRM master. It's not yet possible to add virtual monitors, but one can for example already add virtual input devices. This currently doesn't try to hook up to any logind session, thus will not have a real seat assigned. Currently it's hard coded to "seat0". Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
This commit is contained in:
parent
ee4e78b100
commit
1e2ef9023d
@ -332,7 +332,10 @@ meta_backend_native_lock_layout_group (MetaBackend *backend,
|
||||
const char *
|
||||
meta_backend_native_get_seat_id (MetaBackendNative *backend_native)
|
||||
{
|
||||
return meta_launcher_get_seat_id (backend_native->launcher);
|
||||
if (backend_native->is_headless)
|
||||
return "seat0";
|
||||
else
|
||||
return meta_launcher_get_seat_id (backend_native->launcher);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -513,6 +516,7 @@ meta_backend_native_initable_init (GInitable *initable,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackendNative *native = META_BACKEND_NATIVE (initable);
|
||||
MetaKmsFlags kms_flags;
|
||||
|
||||
if (!meta_is_stage_views_enabled ())
|
||||
{
|
||||
@ -521,9 +525,12 @@ meta_backend_native_initable_init (GInitable *initable,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
native->launcher = meta_launcher_new (error);
|
||||
if (!native->launcher)
|
||||
return FALSE;
|
||||
if (!native->is_headless)
|
||||
{
|
||||
native->launcher = meta_launcher_new (error);
|
||||
if (!native->launcher)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
meta_backend_init_wayland_display (META_BACKEND (native));
|
||||
@ -531,9 +538,11 @@ meta_backend_native_initable_init (GInitable *initable,
|
||||
|
||||
native->udev = meta_udev_new (native);
|
||||
|
||||
native->kms = meta_kms_new (META_BACKEND (native),
|
||||
META_KMS_FLAG_NONE,
|
||||
error);
|
||||
kms_flags = META_KMS_FLAG_NONE;
|
||||
if (native->is_headless)
|
||||
kms_flags |= META_KMS_FLAG_NO_MODE_SETTING;
|
||||
|
||||
native->kms = meta_kms_new (META_BACKEND (native), kms_flags, error);
|
||||
if (!native->kms)
|
||||
return FALSE;
|
||||
|
||||
@ -639,6 +648,13 @@ meta_activate_vt (int vt, GError **error)
|
||||
MetaBackendNative *native = META_BACKEND_NATIVE (backend);
|
||||
MetaLauncher *launcher = meta_backend_native_get_launcher (native);
|
||||
|
||||
if (native->is_headless)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Can't switch VT while headless");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return meta_launcher_activate_vt (launcher, vt, error);
|
||||
}
|
||||
|
||||
|
@ -106,12 +106,19 @@ meta_clutter_backend_native_init_events (ClutterBackend *clutter_backend)
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
|
||||
const char *seat_id;
|
||||
MetaSeatNativeFlag flags;
|
||||
|
||||
seat_id = meta_backend_native_get_seat_id (backend_native);
|
||||
|
||||
if (meta_backend_native_is_headless (backend_native))
|
||||
flags = META_SEAT_NATIVE_FLAG_NO_LIBINPUT;
|
||||
else
|
||||
flags = META_SEAT_NATIVE_FLAG_NONE;
|
||||
|
||||
clutter_backend_native->main_seat = g_object_new (META_TYPE_SEAT_NATIVE,
|
||||
"backend", clutter_backend,
|
||||
"seat-id", seat_id,
|
||||
"flags", flags,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user