mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
Add method to show if in headless mode
MetaBackend can now show whether it is in headless mode or not using a vfunc is_headless. Fallback of is_headless returns FALSE. MetaBackendNative implements is_headless returning its is_headless property. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2130>
This commit is contained in:
parent
44aa6ab735
commit
754c834590
@ -106,6 +106,8 @@ struct _MetaBackendClass
|
||||
|
||||
void (* set_pointer_constraint) (MetaBackend *backend,
|
||||
MetaPointerConstraint *constraint);
|
||||
|
||||
gboolean (* is_headless) (MetaBackend *backend);
|
||||
};
|
||||
|
||||
void meta_backend_destroy (MetaBackend *backend);
|
||||
|
@ -633,12 +633,24 @@ meta_backend_real_create_cursor_tracker (MetaBackend *backend)
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_backend_real_is_headless (MetaBackend *backend)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_backend_is_lid_closed (MetaBackend *backend)
|
||||
{
|
||||
return META_BACKEND_GET_CLASS (backend)->is_lid_closed (backend);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_backend_is_headless (MetaBackend *backend)
|
||||
{
|
||||
return META_BACKEND_GET_CLASS (backend)->is_headless (backend);
|
||||
}
|
||||
|
||||
static void
|
||||
upower_properties_changed (GDBusProxy *proxy,
|
||||
GVariant *changed_properties,
|
||||
@ -859,6 +871,7 @@ meta_backend_class_init (MetaBackendClass *klass)
|
||||
klass->select_stage_events = meta_backend_real_select_stage_events;
|
||||
klass->is_lid_closed = meta_backend_real_is_lid_closed;
|
||||
klass->create_cursor_tracker = meta_backend_real_create_cursor_tracker;
|
||||
klass->is_headless = meta_backend_real_is_headless;
|
||||
|
||||
obj_props[PROP_CONTEXT] =
|
||||
g_param_spec_object ("context",
|
||||
|
@ -130,7 +130,7 @@ meta_backend_native_create_default_seat (MetaBackend *backend,
|
||||
|
||||
seat_id = meta_backend_native_get_seat_id (backend_native);
|
||||
|
||||
if (meta_backend_native_is_headless (backend_native))
|
||||
if (meta_backend_is_headless (backend))
|
||||
flags = META_SEAT_NATIVE_FLAG_NO_LIBINPUT;
|
||||
else
|
||||
flags = META_SEAT_NATIVE_FLAG_NONE;
|
||||
@ -378,10 +378,10 @@ meta_backend_native_get_seat_id (MetaBackendNative *backend_native)
|
||||
return meta_launcher_get_seat_id (backend_native->launcher);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_backend_native_is_headless (MetaBackendNative *backend_native)
|
||||
static gboolean
|
||||
meta_backend_native_is_headless (MetaBackend *backend)
|
||||
{
|
||||
return backend_native->is_headless;
|
||||
return META_BACKEND_NATIVE (backend)->is_headless;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -647,6 +647,8 @@ meta_backend_native_class_init (MetaBackendNativeClass *klass)
|
||||
|
||||
backend_class->set_pointer_constraint = meta_backend_native_set_pointer_constraint;
|
||||
|
||||
backend_class->is_headless = meta_backend_native_is_headless;
|
||||
|
||||
obj_props[PROP_HEADLESS] =
|
||||
g_param_spec_boolean ("headless",
|
||||
"headless",
|
||||
|
@ -50,6 +50,4 @@ MetaKms * meta_backend_native_get_kms (MetaBackendNative *native);
|
||||
|
||||
const char * meta_backend_native_get_seat_id (MetaBackendNative *backend_native);
|
||||
|
||||
gboolean meta_backend_native_is_headless (MetaBackendNative *backend_native);
|
||||
|
||||
#endif /* META_BACKEND_NATIVE_H */
|
||||
|
@ -74,6 +74,9 @@ MetaRemoteAccessController * meta_backend_get_remote_access_controller (MetaBack
|
||||
META_EXPORT
|
||||
gboolean meta_backend_is_rendering_hardware_accelerated (MetaBackend *backend);
|
||||
|
||||
META_EXPORT
|
||||
gboolean meta_backend_is_headless (MetaBackend *backend);
|
||||
|
||||
META_EXPORT
|
||||
void meta_clutter_init (void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user