diff --git a/src/backends/meta-backend-private.h b/src/backends/meta-backend-private.h index 9c9df2cdd..1930a1a33 100644 --- a/src/backends/meta-backend-private.h +++ b/src/backends/meta-backend-private.h @@ -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); diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c index c0b3e4b78..77b99293e 100644 --- a/src/backends/meta-backend.c +++ b/src/backends/meta-backend.c @@ -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", diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c index fcb6b021a..0cbe40d87 100644 --- a/src/backends/native/meta-backend-native.c +++ b/src/backends/native/meta-backend-native.c @@ -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", diff --git a/src/backends/native/meta-backend-native.h b/src/backends/native/meta-backend-native.h index aad4c8413..eac81acb0 100644 --- a/src/backends/native/meta-backend-native.h +++ b/src/backends/native/meta-backend-native.h @@ -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 */ diff --git a/src/meta/meta-backend.h b/src/meta/meta-backend.h index 5b5a8c351..cfb042a72 100644 --- a/src/meta/meta-backend.h +++ b/src/meta/meta-backend.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);