From ef44cc5a536f1d65b69dbf8f4898236df894d699 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 22 Apr 2014 11:28:13 -0400 Subject: [PATCH] cursor-tracker: Have one global cursor tracker Now that we have a global MetaScreen, we can simply have a global MetaCursorTracker as well. Keep the get_for_screen() API around for compatibility, though. --- src/backends/meta-cursor-tracker.c | 12 +++++------- src/core/screen-private.h | 1 - 2 files changed, 5 insertions(+), 8 deletions(-) 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;