From c2a155f767ec69893d6db35ce4a60c640e62dc06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 9 Jul 2020 21:35:34 +0200 Subject: [PATCH] clutter: Remove support not specifying backend This was from the old clutter-as-application-library days, where it had to try find a suitable backend. Now we already have a backend selected (MetaBackend), and the clutter backend is already predecided depending on that, so we don't need the code that auto detects an appropriate one anymore. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364 --- clutter/clutter/clutter-backend.c | 75 ++----------------------------- 1 file changed, 4 insertions(+), 71 deletions(-) diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c index 3c97caa3e..d331f9fad 100644 --- a/clutter/clutter/clutter-backend.c +++ b/clutter/clutter/clutter-backend.c @@ -58,13 +58,6 @@ #include -#ifdef CLUTTER_INPUT_X11 -#include "x11/clutter-backend-x11.h" -#endif -#ifdef CLUTTER_WINDOWING_EGL -#include "egl/clutter-backend-eglnative.h" -#endif - #ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT #include #include @@ -431,23 +424,8 @@ clutter_backend_real_get_features (ClutterBackend *backend) return flags; } -static const char *allowed_backends; - static ClutterBackend * (* custom_backend_func) (void); -static const struct { - const char *name; - ClutterBackend * (* create_backend) (void); -} available_backends[] = { -#ifdef CLUTTER_WINDOWING_X11 - { CLUTTER_WINDOWING_X11, clutter_backend_x11_new }, -#endif -#ifdef CLUTTER_WINDOWING_EGL - { CLUTTER_WINDOWING_EGL, clutter_backend_egl_native_new }, -#endif - { NULL, NULL }, -}; - void clutter_set_custom_backend_func (ClutterBackend *(* func) (void)) { @@ -457,58 +435,13 @@ clutter_set_custom_backend_func (ClutterBackend *(* func) (void)) ClutterBackend * _clutter_create_backend (void) { - const char *backends_list; ClutterBackend *retval; - gboolean allow_any; - char **backends; - int i; - if (custom_backend_func) - { - retval = custom_backend_func (); + g_return_val_if_fail (custom_backend_func, NULL); - if (!retval) - g_error ("Failed to create custom backend."); - - return retval; - } - - if (allowed_backends == NULL) - allowed_backends = "*"; - - allow_any = strstr (allowed_backends, "*") != NULL; - - backends_list = g_getenv ("CLUTTER_BACKEND"); - if (backends_list == NULL) - backends_list = allowed_backends; - - backends = g_strsplit (backends_list, ",", 0); - - retval = NULL; - - for (i = 0; retval == NULL && backends[i] != NULL; i++) - { - const char *backend = backends[i]; - gboolean is_any = g_str_equal (backend, "*"); - int j; - - for (j = 0; available_backends[j].name != NULL; j++) - { - if ((is_any && allow_any) || - (is_any && strstr (allowed_backends, available_backends[j].name)) || - g_str_equal (backend, available_backends[j].name)) - { - retval = available_backends[j].create_backend (); - if (retval != NULL) - break; - } - } - } - - g_strfreev (backends); - - if (retval == NULL) - g_error ("No default Clutter backend found."); + retval = custom_backend_func (); + if (!retval) + g_error ("Failed to create custom backend."); return retval; }