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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
This commit is contained in:
Jonas Ådahl 2021-09-18 12:00:47 +02:00 committed by Marge Bot
parent 579532f644
commit f14b5da387
4 changed files with 19 additions and 63 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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.

View File

@ -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;
}