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.
This commit is contained in:
Jasper St. Pierre 2014-04-22 11:28:13 -04:00
parent 7c0d75e34f
commit ef44cc5a53
2 changed files with 5 additions and 8 deletions

View File

@ -172,6 +172,8 @@ meta_cursor_tracker_new (MetaScreen *screen)
return make_x11_cursor_tracker (screen); return make_x11_cursor_tracker (screen);
} }
static MetaCursorTracker *_cursor_tracker;
/** /**
* meta_cursor_tracker_get_for_screen: * meta_cursor_tracker_get_for_screen:
* @screen: the #MetaScreen * @screen: the #MetaScreen
@ -183,14 +185,10 @@ meta_cursor_tracker_new (MetaScreen *screen)
MetaCursorTracker * MetaCursorTracker *
meta_cursor_tracker_get_for_screen (MetaScreen *screen) 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 _cursor_tracker;
return screen->cursor_tracker;
self = meta_cursor_tracker_new (screen);
screen->cursor_tracker = self;
return self;
} }
static void static void

View File

@ -79,7 +79,6 @@ struct _MetaScreen
MetaStack *stack; MetaStack *stack;
MetaStackTracker *stack_tracker; MetaStackTracker *stack_tracker;
MetaCursorTracker *cursor_tracker;
MetaCursor current_cursor; MetaCursor current_cursor;
Window wm_sn_selection_window; Window wm_sn_selection_window;