From f14b5da387f966c985b1d071cd8d7287779473e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Sat, 18 Sep 2021 12:00:47 +0200 Subject: [PATCH] clutter/backend: Remove 'finish_init()' vfunc The original purpose of being able to report errors is no longer relevant, since the Clutter backend is now practically a thin wrapper around the actual backend, which has already dealt with error reporting. Thus move this to the regular constructor path. Part-of: --- clutter/clutter/clutter-backend-private.h | 5 -- clutter/clutter/clutter-backend.c | 15 ------ clutter/clutter/clutter-main.c | 10 ---- src/backends/x11/meta-clutter-backend-x11.c | 52 ++++++++------------- 4 files changed, 19 insertions(+), 63 deletions(-) diff --git a/clutter/clutter/clutter-backend-private.h b/clutter/clutter/clutter-backend-private.h index 90682afc0..41738e870 100644 --- a/clutter/clutter/clutter-backend-private.h +++ b/clutter/clutter/clutter-backend-private.h @@ -62,8 +62,6 @@ struct _ClutterBackendClass GObjectClass parent_class; /* vfuncs */ - gboolean (* finish_init) (ClutterBackend *backend, - GError **error); ClutterStageWindow * (* create_stage) (ClutterBackend *backend, ClutterStage *wrapper, GError **error); @@ -92,9 +90,6 @@ ClutterStageWindow * _clutter_backend_create_stage (Clutter gboolean _clutter_backend_create_context (ClutterBackend *backend, GError **error); -gboolean _clutter_backend_finish_init (ClutterBackend *backend, - GError **error); - CLUTTER_EXPORT ClutterStageWindow * clutter_backend_get_stage_window (ClutterBackend *backend); diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c index b4e0161aa..b27c6736f 100644 --- a/clutter/clutter/clutter-backend.c +++ b/clutter/clutter/clutter-backend.c @@ -337,21 +337,6 @@ clutter_backend_init (ClutterBackend *self) self->fallback_resource_scale = 1.f; } -gboolean -_clutter_backend_finish_init (ClutterBackend *backend, - GError **error) -{ - ClutterBackendClass *klass; - - g_assert (CLUTTER_IS_BACKEND (backend)); - - klass = CLUTTER_BACKEND_GET_CLASS (backend); - if (klass->finish_init) - return klass->finish_init (backend, error); - - return TRUE; -} - ClutterStageWindow * _clutter_backend_create_stage (ClutterBackend *backend, ClutterStage *wrapper, diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c index d1f421f1c..42f5871b4 100644 --- a/clutter/clutter/clutter-main.c +++ b/clutter/clutter/clutter-main.c @@ -499,16 +499,6 @@ static gboolean clutter_init_real (ClutterContext *clutter_context, GError **error) { - ClutterBackend *backend; - - /* Note, creates backend if not already existing, though parse args will - * have likely created it - */ - backend = clutter_context->backend; - - if (!_clutter_backend_finish_init (backend, error)) - return FALSE; - /* If we are displaying the regions that would get redrawn with clipped * redraws enabled we actually have to disable the clipped redrawing * because otherwise we end up with nasty trails of rectangles everywhere. diff --git a/src/backends/x11/meta-clutter-backend-x11.c b/src/backends/x11/meta-clutter-backend-x11.c index 99beaa51a..e7995cf45 100644 --- a/src/backends/x11/meta-clutter-backend-x11.c +++ b/src/backends/x11/meta-clutter-backend-x11.c @@ -68,37 +68,6 @@ static const gchar *atom_names[] = { /* various flags corresponding to pre init setup calls */ static gboolean clutter_enable_stereo = FALSE; -static gboolean -meta_clutter_backend_x11_finish_init (ClutterBackend *clutter_backend, - GError **error) -{ - MetaClutterBackendX11 *clutter_backend_x11 = - META_CLUTTER_BACKEND_X11 (clutter_backend); - MetaClutterBackendX11Private *priv = - meta_clutter_backend_x11_get_instance_private (clutter_backend_x11); - MetaBackendX11 *backend_x11 = META_BACKEND_X11 (priv->backend); - Atom atoms[N_ATOM_NAMES]; - - clutter_backend_x11->xdisplay = meta_backend_x11_get_xdisplay (backend_x11); - - XInternAtoms (clutter_backend_x11->xdisplay, - (char **) atom_names, N_ATOM_NAMES, - False, atoms); - - clutter_backend_x11->atom_NET_WM_PID = atoms[0]; - clutter_backend_x11->atom_NET_WM_PING = atoms[1]; - clutter_backend_x11->atom_NET_WM_STATE = atoms[2]; - clutter_backend_x11->atom_NET_WM_USER_TIME = atoms[3]; - clutter_backend_x11->atom_WM_PROTOCOLS = atoms[4]; - clutter_backend_x11->atom_WM_DELETE_WINDOW = atoms[5]; - clutter_backend_x11->atom_XEMBED = atoms[6]; - clutter_backend_x11->atom_XEMBED_INFO = atoms[7]; - clutter_backend_x11->atom_NET_WM_NAME = atoms[8]; - clutter_backend_x11->atom_UTF8_STRING = atoms[9]; - - return TRUE; -} - static gboolean check_onscreen_template (CoglRenderer *renderer, CoglOnscreenTemplate *onscreen_template, @@ -233,8 +202,6 @@ meta_clutter_backend_x11_class_init (MetaClutterBackendX11Class *klass) { ClutterBackendClass *clutter_backend_class = CLUTTER_BACKEND_CLASS (klass); - clutter_backend_class->finish_init = meta_clutter_backend_x11_finish_init; - clutter_backend_class->get_display = meta_clutter_backend_x11_get_display; clutter_backend_class->get_renderer = meta_clutter_backend_x11_get_renderer; clutter_backend_class->create_stage = meta_clutter_backend_x11_create_stage; @@ -245,6 +212,8 @@ meta_clutter_backend_x11_class_init (MetaClutterBackendX11Class *klass) MetaClutterBackendX11 * meta_clutter_backend_x11_new (MetaBackend *backend) { + MetaBackendX11 *backend_x11 = META_BACKEND_X11 (backend); + Atom atoms[N_ATOM_NAMES]; MetaClutterBackendX11 *clutter_backend_x11; MetaClutterBackendX11Private *priv; @@ -252,6 +221,23 @@ meta_clutter_backend_x11_new (MetaBackend *backend) priv = meta_clutter_backend_x11_get_instance_private (clutter_backend_x11); priv->backend = backend; + clutter_backend_x11->xdisplay = meta_backend_x11_get_xdisplay (backend_x11); + + XInternAtoms (clutter_backend_x11->xdisplay, + (char **) atom_names, N_ATOM_NAMES, + False, atoms); + + clutter_backend_x11->atom_NET_WM_PID = atoms[0]; + clutter_backend_x11->atom_NET_WM_PING = atoms[1]; + clutter_backend_x11->atom_NET_WM_STATE = atoms[2]; + clutter_backend_x11->atom_NET_WM_USER_TIME = atoms[3]; + clutter_backend_x11->atom_WM_PROTOCOLS = atoms[4]; + clutter_backend_x11->atom_WM_DELETE_WINDOW = atoms[5]; + clutter_backend_x11->atom_XEMBED = atoms[6]; + clutter_backend_x11->atom_XEMBED_INFO = atoms[7]; + clutter_backend_x11->atom_NET_WM_NAME = atoms[8]; + clutter_backend_x11->atom_UTF8_STRING = atoms[9]; + return clutter_backend_x11; }