From 11e200556310f8f6d65236d58af06ae6705dd9c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 6 Sep 2018 14:14:59 +0200 Subject: [PATCH] backends/native: Remove instance private The object struct definition itself is private, so the object instance private serves no purpose. Thus, move the fields into the object struct and remove the instance private struct. https://gitlab.gnome.org/GNOME/mutter/issues/548 https://gitlab.gnome.org/GNOME/mutter/merge_requests/525 --- src/backends/native/meta-backend-native.c | 32 ++++++----------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c index 6f21f9c2c..e4e9be225 100644 --- a/src/backends/native/meta-backend-native.c +++ b/src/backends/native/meta-backend-native.c @@ -62,14 +62,10 @@ struct _MetaBackendNative { MetaBackend parent; -}; -struct _MetaBackendNativePrivate -{ MetaLauncher *launcher; MetaBarrierManagerNative *barrier_manager; }; -typedef struct _MetaBackendNativePrivate MetaBackendNativePrivate; static GInitableIface *initable_parent_iface; @@ -77,7 +73,6 @@ static void initable_iface_init (GInitableIface *initable_iface); G_DEFINE_TYPE_WITH_CODE (MetaBackendNative, meta_backend_native, META_TYPE_BACKEND, - G_ADD_PRIVATE (MetaBackendNative) G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init)) @@ -85,9 +80,8 @@ static void meta_backend_native_finalize (GObject *object) { MetaBackendNative *native = META_BACKEND_NATIVE (object); - MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private (native); - meta_launcher_free (priv->launcher); + meta_launcher_free (native->launcher); G_OBJECT_CLASS (meta_backend_native_parent_class)->finalize (object); } @@ -99,10 +93,8 @@ constrain_to_barriers (ClutterInputDevice *device, float *new_y) { MetaBackendNative *native = META_BACKEND_NATIVE (meta_get_backend ()); - MetaBackendNativePrivate *priv = - meta_backend_native_get_instance_private (native); - meta_barrier_manager_native_process (priv->barrier_manager, + meta_barrier_manager_native_process (native->barrier_manager, device, time, new_x, new_y); @@ -575,26 +567,22 @@ meta_backend_native_class_init (MetaBackendNativeClass *klass) static void meta_backend_native_init (MetaBackendNative *native) { - MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private (native); GError *error = NULL; - priv->launcher = meta_launcher_new (&error); - if (priv->launcher == NULL) + native->launcher = meta_launcher_new (&error); + if (native->launcher == NULL) { g_warning ("Can't initialize KMS backend: %s\n", error->message); exit (1); } - priv->barrier_manager = meta_barrier_manager_native_new (); + native->barrier_manager = meta_barrier_manager_native_new (); } MetaLauncher * meta_backend_native_get_launcher (MetaBackendNative *native) { - MetaBackendNativePrivate *priv = - meta_backend_native_get_instance_private (native); - - return priv->launcher; + return native->launcher; } gboolean @@ -610,10 +598,7 @@ meta_activate_vt (int vt, GError **error) MetaBarrierManagerNative * meta_backend_native_get_barrier_manager (MetaBackendNative *native) { - MetaBackendNativePrivate *priv = - meta_backend_native_get_instance_private (native); - - return priv->barrier_manager; + return native->barrier_manager; } /** @@ -634,9 +619,8 @@ meta_activate_session (void) return TRUE; MetaBackendNative *native = META_BACKEND_NATIVE (backend); - MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private (native); - if (!meta_launcher_activate_session (priv->launcher, &error)) + if (!meta_launcher_activate_session (native->launcher, &error)) { g_warning ("Could not activate session: %s\n", error->message); g_error_free (error);