Move the cursor renderer to the backend

This commit is contained in:
Jasper St. Pierre 2014-04-22 14:32:55 -04:00
parent eac6e9ed41
commit 326740e00f
4 changed files with 28 additions and 16 deletions

View File

@ -45,6 +45,7 @@ meta_get_backend (void)
struct _MetaBackendPrivate
{
MetaMonitorManager *monitor_manager;
MetaCursorRenderer *cursor_renderer;
};
typedef struct _MetaBackendPrivate MetaBackendPrivate;
@ -80,7 +81,9 @@ meta_backend_finalize (GObject *object)
static void
meta_backend_real_post_init (MetaBackend *backend)
{
/* Do nothing */
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
priv->cursor_renderer = meta_cursor_renderer_new ();
}
static void
@ -146,6 +149,14 @@ meta_backend_get_monitor_manager (MetaBackend *backend)
return priv->monitor_manager;
}
MetaCursorRenderer *
meta_backend_get_cursor_renderer (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
return priv->cursor_renderer;
}
static GType
get_backend_type (void)
{

View File

@ -29,6 +29,7 @@
#include <meta/meta-idle-monitor.h>
#include "meta-monitor-manager.h"
#include "meta-cursor-renderer.h"
typedef struct _MetaBackend MetaBackend;
typedef struct _MetaBackendClass MetaBackendClass;
@ -40,6 +41,7 @@ MetaBackend * meta_get_backend (void);
MetaIdleMonitor * meta_backend_get_idle_monitor (MetaBackend *backend,
int device_id);
MetaMonitorManager * meta_backend_get_monitor_manager (MetaBackend *backend);
MetaCursorRenderer * meta_backend_get_cursor_renderer (MetaBackend *backend);
void meta_clutter_init (void);

View File

@ -40,6 +40,8 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include "meta-backend.h"
#include "meta-cursor-private.h"
#include "meta-cursor-tracker-private.h"
#include "screen-private.h"
@ -134,12 +136,13 @@ meta_cursor_tracker_class_init (MetaCursorTrackerClass *klass)
static MetaCursorTracker *
make_wayland_cursor_tracker (MetaScreen *screen)
{
MetaBackend *backend = meta_get_backend ();
MetaWaylandCompositor *compositor;
MetaCursorTracker *self;
self = g_object_new (META_TYPE_CURSOR_TRACKER, NULL);
self->screen = screen;
self->renderer = meta_cursor_renderer_new ();
self->renderer = meta_backend_get_cursor_renderer (backend);
compositor = meta_wayland_compositor_get_default ();
compositor->seat->pointer.cursor_tracker = self;
@ -151,11 +154,12 @@ make_wayland_cursor_tracker (MetaScreen *screen)
static MetaCursorTracker *
make_x11_cursor_tracker (MetaScreen *screen)
{
MetaBackend *backend = meta_get_backend ();
MetaCursorTracker *self;
self = g_object_new (META_TYPE_CURSOR_TRACKER, NULL);
self->screen = screen;
self->renderer = meta_cursor_renderer_new ();
self->renderer = meta_backend_get_cursor_renderer (backend);
XFixesSelectCursorInput (screen->display->xdisplay,
screen->xroot,

View File

@ -23,27 +23,22 @@
#include "meta-wayland-stage.h"
#include "display-private.h"
#include "meta-cursor-tracker-private.h"
#include "meta-backend.h"
#include <meta/util.h>
G_DEFINE_TYPE (MetaWaylandStage, meta_wayland_stage, CLUTTER_TYPE_STAGE);
static void
meta_wayland_stage_paint (ClutterActor *actor)
{
MetaDisplay *display = meta_get_display ();
MetaCursorTracker *tracker;
CLUTTER_ACTOR_CLASS (meta_wayland_stage_parent_class)->paint (actor);
/* Early in initialization, we can hit this. */
if (!display)
return;
tracker = meta_cursor_tracker_get_for_screen (display->screen);
if (tracker)
meta_cursor_renderer_paint (tracker->renderer);
if (meta_is_wayland_compositor ())
{
MetaBackend *backend = meta_get_backend ();
MetaCursorRenderer *renderer = meta_backend_get_cursor_renderer (backend);
meta_cursor_renderer_paint (renderer);
}
}
static void