diff --git a/src/backends/meta-cursor-tracker.c b/src/backends/meta-cursor-tracker.c index 56c1f6ff5..d3486211b 100644 --- a/src/backends/meta-cursor-tracker.c +++ b/src/backends/meta-cursor-tracker.c @@ -172,6 +172,8 @@ meta_cursor_tracker_new (MetaScreen *screen) return make_x11_cursor_tracker (screen); } +static MetaCursorTracker *_cursor_tracker; + /** * meta_cursor_tracker_get_for_screen: * @screen: the #MetaScreen @@ -183,14 +185,10 @@ meta_cursor_tracker_new (MetaScreen *screen) MetaCursorTracker * meta_cursor_tracker_get_for_screen (MetaScreen *screen) { - MetaCursorTracker *self; + if (!_cursor_tracker) + _cursor_tracker = meta_cursor_tracker_new (screen); - if (screen->cursor_tracker) - return screen->cursor_tracker; - - self = meta_cursor_tracker_new (screen); - screen->cursor_tracker = self; - return self; + return _cursor_tracker; } static void diff --git a/src/core/screen-private.h b/src/core/screen-private.h index ef279e580..364ca1595 100644 --- a/src/core/screen-private.h +++ b/src/core/screen-private.h @@ -79,7 +79,6 @@ struct _MetaScreen MetaStack *stack; MetaStackTracker *stack_tracker; - MetaCursorTracker *cursor_tracker; MetaCursor current_cursor; Window wm_sn_selection_window;