mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
clutter/backend/x11: Keep a pointer to the actual backend
As with the native backend, eliminate going via some globals when getting the backend. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2002>
This commit is contained in:
parent
1fbdfa8ca7
commit
6ae9bc9045
@ -620,7 +620,7 @@ meta_backend_x11_post_init (MetaBackend *backend)
|
|||||||
static ClutterBackend *
|
static ClutterBackend *
|
||||||
meta_backend_x11_create_clutter_backend (MetaBackend *backend)
|
meta_backend_x11_create_clutter_backend (MetaBackend *backend)
|
||||||
{
|
{
|
||||||
return g_object_new (META_TYPE_CLUTTER_BACKEND_X11, NULL);
|
return CLUTTER_BACKEND (meta_clutter_backend_x11_new (backend));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ClutterSeat *
|
static ClutterSeat *
|
||||||
|
@ -47,9 +47,13 @@ struct _MetaX11EventFilter
|
|||||||
gpointer data;
|
gpointer data;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaClutterBackendX11, meta_clutter_backend_x11,
|
typedef struct _MetaClutterBackendX11Private
|
||||||
CLUTTER_TYPE_BACKEND)
|
{
|
||||||
|
MetaBackend *backend;
|
||||||
|
} MetaClutterBackendX11Private;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE_WITH_PRIVATE (MetaClutterBackendX11, meta_clutter_backend_x11,
|
||||||
|
CLUTTER_TYPE_BACKEND)
|
||||||
|
|
||||||
/* atoms; remember to add the code that assigns the atom value to
|
/* atoms; remember to add the code that assigns the atom value to
|
||||||
* the member of the MetaClutterBackendX11 structure if you add an
|
* the member of the MetaClutterBackendX11 structure if you add an
|
||||||
@ -336,8 +340,11 @@ static CoglRenderer *
|
|||||||
meta_clutter_backend_x11_get_renderer (ClutterBackend *clutter_backend,
|
meta_clutter_backend_x11_get_renderer (ClutterBackend *clutter_backend,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
MetaBackend *backend = meta_get_backend ();
|
MetaClutterBackendX11 *clutter_backend_x11 =
|
||||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
META_CLUTTER_BACKEND_X11 (clutter_backend);
|
||||||
|
MetaClutterBackendX11Private *priv =
|
||||||
|
meta_clutter_backend_x11_get_instance_private (clutter_backend_x11);
|
||||||
|
MetaRenderer *renderer = meta_backend_get_renderer (priv->backend);
|
||||||
|
|
||||||
return meta_renderer_create_cogl_renderer (renderer);
|
return meta_renderer_create_cogl_renderer (renderer);
|
||||||
}
|
}
|
||||||
@ -407,7 +414,8 @@ meta_clutter_backend_x11_translate_event (ClutterBackend *clutter_backend,
|
|||||||
{
|
{
|
||||||
MetaClutterBackendX11 *clutter_backend_x11 =
|
MetaClutterBackendX11 *clutter_backend_x11 =
|
||||||
META_CLUTTER_BACKEND_X11 (clutter_backend);
|
META_CLUTTER_BACKEND_X11 (clutter_backend);
|
||||||
MetaBackend *backend = meta_get_backend ();
|
MetaClutterBackendX11Private *priv =
|
||||||
|
meta_clutter_backend_x11_get_instance_private (clutter_backend_x11);
|
||||||
MetaStageX11 *stage_x11;
|
MetaStageX11 *stage_x11;
|
||||||
ClutterSeat *seat;
|
ClutterSeat *seat;
|
||||||
|
|
||||||
@ -426,7 +434,7 @@ meta_clutter_backend_x11_translate_event (ClutterBackend *clutter_backend,
|
|||||||
if (meta_stage_x11_translate_event (stage_x11, native, event))
|
if (meta_stage_x11_translate_event (stage_x11, native, event))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
seat = meta_backend_get_default_seat (backend);
|
seat = meta_backend_get_default_seat (priv->backend);
|
||||||
if (meta_seat_x11_translate_event (META_SEAT_X11 (seat), native, event))
|
if (meta_seat_x11_translate_event (META_SEAT_X11 (seat), native, event))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
@ -436,9 +444,12 @@ meta_clutter_backend_x11_translate_event (ClutterBackend *clutter_backend,
|
|||||||
static ClutterSeat *
|
static ClutterSeat *
|
||||||
meta_clutter_backend_x11_get_default_seat (ClutterBackend *clutter_backend)
|
meta_clutter_backend_x11_get_default_seat (ClutterBackend *clutter_backend)
|
||||||
{
|
{
|
||||||
MetaBackend *backend = meta_get_backend ();
|
MetaClutterBackendX11 *clutter_backend_x11 =
|
||||||
|
META_CLUTTER_BACKEND_X11 (clutter_backend);
|
||||||
|
MetaClutterBackendX11Private *priv =
|
||||||
|
meta_clutter_backend_x11_get_instance_private (clutter_backend_x11);
|
||||||
|
|
||||||
return meta_backend_get_default_seat (backend);
|
return meta_backend_get_default_seat (priv->backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -472,6 +483,19 @@ meta_clutter_backend_x11_class_init (MetaClutterBackendX11Class *klass)
|
|||||||
clutter_backend_class->is_display_server = meta_clutter_backend_x11_is_display_server;
|
clutter_backend_class->is_display_server = meta_clutter_backend_x11_is_display_server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetaClutterBackendX11 *
|
||||||
|
meta_clutter_backend_x11_new (MetaBackend *backend)
|
||||||
|
{
|
||||||
|
MetaClutterBackendX11 *clutter_backend_x11;
|
||||||
|
MetaClutterBackendX11Private *priv;
|
||||||
|
|
||||||
|
clutter_backend_x11 = g_object_new (META_TYPE_CLUTTER_BACKEND_X11, NULL);
|
||||||
|
priv = meta_clutter_backend_x11_get_instance_private (clutter_backend_x11);
|
||||||
|
priv->backend = backend;
|
||||||
|
|
||||||
|
return clutter_backend_x11;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
error_handler (Display *xdisplay,
|
error_handler (Display *xdisplay,
|
||||||
XErrorEvent *error)
|
XErrorEvent *error)
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
#include "backends/meta-backend-types.h"
|
||||||
#include "clutter/clutter-mutter.h"
|
#include "clutter/clutter-mutter.h"
|
||||||
|
|
||||||
struct _MetaClutterBackendX11
|
struct _MetaClutterBackendX11
|
||||||
@ -73,6 +74,8 @@ typedef MetaX11FilterReturn (*MetaX11FilterFunc) (XEvent *xev,
|
|||||||
ClutterEvent *cev,
|
ClutterEvent *cev,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
|
MetaClutterBackendX11 * meta_clutter_backend_x11_new (MetaBackend *backend);
|
||||||
|
|
||||||
void meta_clutter_x11_trap_x_errors (void);
|
void meta_clutter_x11_trap_x_errors (void);
|
||||||
gint meta_clutter_x11_untrap_x_errors (void);
|
gint meta_clutter_x11_untrap_x_errors (void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user