mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
clutter/backend/native: Keep a pointer to the actual backend
This eliminates going via a global variable. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2002>
This commit is contained in:
parent
cf1715ac43
commit
1fbdfa8ca7
@ -117,7 +117,7 @@ meta_backend_native_dispose (GObject *object)
|
||||
static ClutterBackend *
|
||||
meta_backend_native_create_clutter_backend (MetaBackend *backend)
|
||||
{
|
||||
return g_object_new (META_TYPE_CLUTTER_BACKEND_NATIVE, NULL);
|
||||
return CLUTTER_BACKEND (meta_clutter_backend_native_new (backend));
|
||||
}
|
||||
|
||||
static ClutterSeat *
|
||||
|
@ -54,6 +54,8 @@
|
||||
struct _MetaClutterBackendNative
|
||||
{
|
||||
ClutterBackend parent;
|
||||
|
||||
MetaBackend *backend;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaClutterBackendNative, meta_clutter_backend_native,
|
||||
@ -63,7 +65,9 @@ static CoglRenderer *
|
||||
meta_clutter_backend_native_get_renderer (ClutterBackend *clutter_backend,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaClutterBackendNative *clutter_backend_nativen =
|
||||
META_CLUTTER_BACKEND_NATIVE (clutter_backend);
|
||||
MetaBackend *backend = clutter_backend_nativen->backend;
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
|
||||
return meta_renderer_create_cogl_renderer (renderer);
|
||||
@ -83,7 +87,9 @@ meta_clutter_backend_native_create_stage (ClutterBackend *clutter_backend,
|
||||
static ClutterSeat *
|
||||
meta_clutter_backend_native_get_default_seat (ClutterBackend *clutter_backend)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaClutterBackendNative *clutter_backend_nativen =
|
||||
META_CLUTTER_BACKEND_NATIVE (clutter_backend);
|
||||
MetaBackend *backend = clutter_backend_nativen->backend;
|
||||
|
||||
return meta_backend_get_default_seat (backend);
|
||||
}
|
||||
@ -109,3 +115,15 @@ meta_clutter_backend_native_class_init (MetaClutterBackendNativeClass *klass)
|
||||
clutter_backend_class->get_default_seat = meta_clutter_backend_native_get_default_seat;
|
||||
clutter_backend_class->is_display_server = meta_clutter_backend_native_is_display_server;
|
||||
}
|
||||
|
||||
MetaClutterBackendNative *
|
||||
meta_clutter_backend_native_new (MetaBackend *backend)
|
||||
{
|
||||
MetaClutterBackendNative *clutter_backend_native;
|
||||
|
||||
clutter_backend_native = g_object_new (META_TYPE_CLUTTER_BACKEND_NATIVE,
|
||||
NULL);
|
||||
clutter_backend_native->backend = backend;
|
||||
|
||||
return clutter_backend_native;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "backends/meta-backend-types.h"
|
||||
#include "backends/native/meta-stage-native.h"
|
||||
#include "clutter/clutter.h"
|
||||
|
||||
@ -35,4 +36,6 @@ G_DECLARE_FINAL_TYPE (MetaClutterBackendNative, meta_clutter_backend_native,
|
||||
META, CLUTTER_BACKEND_NATIVE,
|
||||
ClutterBackend)
|
||||
|
||||
MetaClutterBackendNative * meta_clutter_backend_native_new (MetaBackend *backend);
|
||||
|
||||
#endif /* META_CLUTTER_BACKEND_NATIVE_H */
|
||||
|
Loading…
Reference in New Issue
Block a user