cursor: Don't access the cursor tracker from the screen directly

Go through the get_for_screen getter.
This commit is contained in:
Jasper St. Pierre 2014-04-22 11:27:52 -04:00
parent ee812e3fe0
commit 7c0d75e34f
4 changed files with 23 additions and 15 deletions

View File

@ -1768,6 +1768,7 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
{
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (screen);
MetaCursor cursor = meta_cursor_for_grab_op (op);
MetaCursorReference *cursor_ref;
@ -1803,8 +1804,8 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
meta_error_trap_pop (display);
cursor_ref = meta_cursor_reference_from_theme (screen->cursor_tracker, cursor);
meta_cursor_tracker_set_grab_cursor (screen->cursor_tracker, cursor_ref);
cursor_ref = meta_cursor_reference_from_theme (tracker, cursor);
meta_cursor_tracker_set_grab_cursor (tracker, cursor_ref);
meta_cursor_reference_unref (cursor_ref);
}
@ -1980,9 +1981,11 @@ void
meta_display_end_grab_op (MetaDisplay *display,
guint32 timestamp)
{
MetaCursorTracker *tracker;
meta_topic (META_DEBUG_WINDOW_OPS,
"Ending grab op %u at time %u\n", display->grab_op, timestamp);
if (display->grab_op == META_GRAB_OP_NONE)
return;
@ -2025,7 +2028,8 @@ meta_display_end_grab_op (MetaDisplay *display,
meta_screen_ungrab_all_keys (display->screen, timestamp);
}
meta_cursor_tracker_set_grab_cursor (display->screen->cursor_tracker, NULL);
tracker = meta_cursor_tracker_get_for_screen (display->screen);
meta_cursor_tracker_set_grab_cursor (tracker, NULL);
display->grab_timestamp = 0;
display->grab_window = NULL;

View File

@ -1388,9 +1388,10 @@ meta_screen_update_cursor (MetaScreen *screen)
MetaCursor cursor = screen->current_cursor;
Cursor xcursor;
MetaCursorReference *cursor_ref;
MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (screen);
cursor_ref = meta_cursor_reference_from_theme (screen->cursor_tracker, cursor);
meta_cursor_tracker_set_root_cursor (screen->cursor_tracker, cursor_ref);
cursor_ref = meta_cursor_reference_from_theme (tracker, cursor);
meta_cursor_tracker_set_root_cursor (tracker, cursor_ref);
meta_cursor_reference_unref (cursor_ref);
/* Set a cursor for X11 applications that don't specify their own */
@ -1498,6 +1499,7 @@ MetaWindow*
meta_screen_get_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one)
{
MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (screen);
MetaWindow *window;
int x, y;
@ -1505,8 +1507,7 @@ meta_screen_get_mouse_window (MetaScreen *screen,
meta_topic (META_DEBUG_FOCUS,
"Focusing mouse window excluding %s\n", not_this_one->desc);
meta_cursor_tracker_get_pointer (screen->cursor_tracker,
&x, &y, NULL);
meta_cursor_tracker_get_pointer (tracker, &x, &y, NULL);
window = meta_stack_get_default_focus_window_at_point (screen->stack,
screen->active_workspace,
@ -1785,6 +1786,8 @@ meta_screen_get_current_monitor_for_pos (MetaScreen *screen,
int
meta_screen_get_current_monitor (MetaScreen *screen)
{
MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (screen);
if (screen->n_monitor_infos == 1)
return 0;
@ -1795,8 +1798,7 @@ meta_screen_get_current_monitor (MetaScreen *screen)
{
int x, y;
meta_cursor_tracker_get_pointer (screen->cursor_tracker,
&x, &y, NULL);
meta_cursor_tracker_get_pointer (tracker, &x, &y, NULL);
meta_screen_get_current_monitor_for_pos (screen, x, y);
}
@ -3311,7 +3313,9 @@ gboolean
meta_screen_handle_xevent (MetaScreen *screen,
XEvent *xevent)
{
if (meta_cursor_tracker_handle_xevent (screen->cursor_tracker, xevent))
MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (screen);
if (meta_cursor_tracker_handle_xevent (tracker, xevent))
return TRUE;
return FALSE;

View File

@ -9220,6 +9220,7 @@ window_focus_on_pointer_rest_callback (gpointer data)
MetaWindow *window = focus_data->window;
MetaDisplay *display = window->display;
MetaScreen *screen = window->screen;
MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (screen);
int root_x, root_y;
guint32 timestamp;
ClutterActor *child;
@ -9227,8 +9228,7 @@ window_focus_on_pointer_rest_callback (gpointer data)
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK)
goto out;
meta_cursor_tracker_get_pointer (screen->cursor_tracker,
&root_x, &root_y, NULL);
meta_cursor_tracker_get_pointer (tracker, &root_x, &root_y, NULL);
if (root_x != focus_data->pointer_x ||
root_y != focus_data->pointer_y)

View File

@ -1560,11 +1560,11 @@ meta_window_x11_property_notify (MetaWindow *window,
static int
query_pressed_buttons (MetaWindow *window)
{
MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (window->screen);
ClutterModifierType mods;
int button = 0;
meta_cursor_tracker_get_pointer (window->screen->cursor_tracker,
NULL, NULL, &mods);
meta_cursor_tracker_get_pointer (tracker, NULL, NULL, &mods);
if (mods & CLUTTER_BUTTON1_MASK)
button |= 1 << 1;