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

View File

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

View File

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

View File

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