diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c index cda4bc36c..a753c07c4 100644 --- a/src/backends/meta-backend.c +++ b/src/backends/meta-backend.c @@ -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) { diff --git a/src/backends/meta-backend.h b/src/backends/meta-backend.h index 83aef23c2..d0a187785 100644 --- a/src/backends/meta-backend.h +++ b/src/backends/meta-backend.h @@ -29,6 +29,7 @@ #include #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); diff --git a/src/backends/meta-cursor-tracker.c b/src/backends/meta-cursor-tracker.c index b05d472e1..12fe21cb1 100644 --- a/src/backends/meta-cursor-tracker.c +++ b/src/backends/meta-cursor-tracker.c @@ -40,6 +40,8 @@ #include #include +#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, diff --git a/src/wayland/meta-wayland-stage.c b/src/wayland/meta-wayland-stage.c index 39e41ab69..6c83329db 100644 --- a/src/wayland/meta-wayland-stage.c +++ b/src/wayland/meta-wayland-stage.c @@ -23,27 +23,22 @@ #include "meta-wayland-stage.h" -#include "display-private.h" -#include "meta-cursor-tracker-private.h" +#include "meta-backend.h" +#include 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