cursor-tracker: Don't cache a private pointer to the cursor renderer

This means we don't rely on contruction order any more.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2016-12-01 16:54:04 +08:00
parent 6dbb524b9f
commit e35ac9be8d
2 changed files with 10 additions and 7 deletions

View File

@ -30,8 +30,6 @@
struct _MetaCursorTracker {
GObject parent_instance;
MetaCursorRenderer *renderer;
gboolean is_showing;
MetaCursorSprite *displayed_cursor;

View File

@ -73,7 +73,11 @@ get_displayed_cursor (MetaCursorTracker *tracker)
static void
update_displayed_cursor (MetaCursorTracker *tracker)
{
meta_cursor_renderer_set_cursor (tracker->renderer, tracker->displayed_cursor);
MetaBackend *backend = meta_get_backend ();
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
meta_cursor_renderer_set_cursor (cursor_renderer, tracker->displayed_cursor);
}
static void
@ -95,9 +99,6 @@ sync_cursor (MetaCursorTracker *tracker)
static void
meta_cursor_tracker_init (MetaCursorTracker *self)
{
MetaBackend *backend = meta_get_backend ();
self->renderer = meta_backend_get_cursor_renderer (backend);
self->is_showing = TRUE;
}
@ -358,9 +359,13 @@ meta_cursor_tracker_update_position (MetaCursorTracker *tracker,
int new_x,
int new_y)
{
MetaBackend *backend = meta_get_backend ();
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
g_assert (meta_is_wayland_compositor ());
meta_cursor_renderer_set_position (tracker->renderer, new_x, new_y);
meta_cursor_renderer_set_position (cursor_renderer, new_x, new_y);
}
static void