Move the cursor renderer to the backend
This commit is contained in:
parent
eac6e9ed41
commit
326740e00f
@ -45,6 +45,7 @@ meta_get_backend (void)
|
|||||||
struct _MetaBackendPrivate
|
struct _MetaBackendPrivate
|
||||||
{
|
{
|
||||||
MetaMonitorManager *monitor_manager;
|
MetaMonitorManager *monitor_manager;
|
||||||
|
MetaCursorRenderer *cursor_renderer;
|
||||||
};
|
};
|
||||||
typedef struct _MetaBackendPrivate MetaBackendPrivate;
|
typedef struct _MetaBackendPrivate MetaBackendPrivate;
|
||||||
|
|
||||||
@ -80,7 +81,9 @@ meta_backend_finalize (GObject *object)
|
|||||||
static void
|
static void
|
||||||
meta_backend_real_post_init (MetaBackend *backend)
|
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
|
static void
|
||||||
@ -146,6 +149,14 @@ meta_backend_get_monitor_manager (MetaBackend *backend)
|
|||||||
return priv->monitor_manager;
|
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
|
static GType
|
||||||
get_backend_type (void)
|
get_backend_type (void)
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <meta/meta-idle-monitor.h>
|
#include <meta/meta-idle-monitor.h>
|
||||||
#include "meta-monitor-manager.h"
|
#include "meta-monitor-manager.h"
|
||||||
|
#include "meta-cursor-renderer.h"
|
||||||
|
|
||||||
typedef struct _MetaBackend MetaBackend;
|
typedef struct _MetaBackend MetaBackend;
|
||||||
typedef struct _MetaBackendClass MetaBackendClass;
|
typedef struct _MetaBackendClass MetaBackendClass;
|
||||||
@ -40,6 +41,7 @@ MetaBackend * meta_get_backend (void);
|
|||||||
MetaIdleMonitor * meta_backend_get_idle_monitor (MetaBackend *backend,
|
MetaIdleMonitor * meta_backend_get_idle_monitor (MetaBackend *backend,
|
||||||
int device_id);
|
int device_id);
|
||||||
MetaMonitorManager * meta_backend_get_monitor_manager (MetaBackend *backend);
|
MetaMonitorManager * meta_backend_get_monitor_manager (MetaBackend *backend);
|
||||||
|
MetaCursorRenderer * meta_backend_get_cursor_renderer (MetaBackend *backend);
|
||||||
|
|
||||||
void meta_clutter_init (void);
|
void meta_clutter_init (void);
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
|
|
||||||
|
#include "meta-backend.h"
|
||||||
|
|
||||||
#include "meta-cursor-private.h"
|
#include "meta-cursor-private.h"
|
||||||
#include "meta-cursor-tracker-private.h"
|
#include "meta-cursor-tracker-private.h"
|
||||||
#include "screen-private.h"
|
#include "screen-private.h"
|
||||||
@ -134,12 +136,13 @@ meta_cursor_tracker_class_init (MetaCursorTrackerClass *klass)
|
|||||||
static MetaCursorTracker *
|
static MetaCursorTracker *
|
||||||
make_wayland_cursor_tracker (MetaScreen *screen)
|
make_wayland_cursor_tracker (MetaScreen *screen)
|
||||||
{
|
{
|
||||||
|
MetaBackend *backend = meta_get_backend ();
|
||||||
MetaWaylandCompositor *compositor;
|
MetaWaylandCompositor *compositor;
|
||||||
MetaCursorTracker *self;
|
MetaCursorTracker *self;
|
||||||
|
|
||||||
self = g_object_new (META_TYPE_CURSOR_TRACKER, NULL);
|
self = g_object_new (META_TYPE_CURSOR_TRACKER, NULL);
|
||||||
self->screen = screen;
|
self->screen = screen;
|
||||||
self->renderer = meta_cursor_renderer_new ();
|
self->renderer = meta_backend_get_cursor_renderer (backend);
|
||||||
|
|
||||||
compositor = meta_wayland_compositor_get_default ();
|
compositor = meta_wayland_compositor_get_default ();
|
||||||
compositor->seat->pointer.cursor_tracker = self;
|
compositor->seat->pointer.cursor_tracker = self;
|
||||||
@ -151,11 +154,12 @@ make_wayland_cursor_tracker (MetaScreen *screen)
|
|||||||
static MetaCursorTracker *
|
static MetaCursorTracker *
|
||||||
make_x11_cursor_tracker (MetaScreen *screen)
|
make_x11_cursor_tracker (MetaScreen *screen)
|
||||||
{
|
{
|
||||||
|
MetaBackend *backend = meta_get_backend ();
|
||||||
MetaCursorTracker *self;
|
MetaCursorTracker *self;
|
||||||
|
|
||||||
self = g_object_new (META_TYPE_CURSOR_TRACKER, NULL);
|
self = g_object_new (META_TYPE_CURSOR_TRACKER, NULL);
|
||||||
self->screen = screen;
|
self->screen = screen;
|
||||||
self->renderer = meta_cursor_renderer_new ();
|
self->renderer = meta_backend_get_cursor_renderer (backend);
|
||||||
|
|
||||||
XFixesSelectCursorInput (screen->display->xdisplay,
|
XFixesSelectCursorInput (screen->display->xdisplay,
|
||||||
screen->xroot,
|
screen->xroot,
|
||||||
|
@ -23,27 +23,22 @@
|
|||||||
|
|
||||||
#include "meta-wayland-stage.h"
|
#include "meta-wayland-stage.h"
|
||||||
|
|
||||||
#include "display-private.h"
|
#include "meta-backend.h"
|
||||||
#include "meta-cursor-tracker-private.h"
|
#include <meta/util.h>
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaWaylandStage, meta_wayland_stage, CLUTTER_TYPE_STAGE);
|
G_DEFINE_TYPE (MetaWaylandStage, meta_wayland_stage, CLUTTER_TYPE_STAGE);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_wayland_stage_paint (ClutterActor *actor)
|
meta_wayland_stage_paint (ClutterActor *actor)
|
||||||
{
|
{
|
||||||
MetaDisplay *display = meta_get_display ();
|
|
||||||
MetaCursorTracker *tracker;
|
|
||||||
|
|
||||||
CLUTTER_ACTOR_CLASS (meta_wayland_stage_parent_class)->paint (actor);
|
CLUTTER_ACTOR_CLASS (meta_wayland_stage_parent_class)->paint (actor);
|
||||||
|
|
||||||
/* Early in initialization, we can hit this. */
|
if (meta_is_wayland_compositor ())
|
||||||
if (!display)
|
{
|
||||||
return;
|
MetaBackend *backend = meta_get_backend ();
|
||||||
|
MetaCursorRenderer *renderer = meta_backend_get_cursor_renderer (backend);
|
||||||
tracker = meta_cursor_tracker_get_for_screen (display->screen);
|
meta_cursor_renderer_paint (renderer);
|
||||||
|
}
|
||||||
if (tracker)
|
|
||||||
meta_cursor_renderer_paint (tracker->renderer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user