cursor-tracker: Make set_grab_cursor take a MetaCursorReference

This commit is contained in:
Jasper St. Pierre 2014-03-31 16:17:49 -04:00
parent 0efb0b47eb
commit fa60824096
3 changed files with 12 additions and 8 deletions

View File

@ -1839,6 +1839,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 };
MetaCursor cursor = meta_cursor_for_grab_op (op);
MetaCursorReference *cursor_ref;
XISetMask (mask.mask, XI_ButtonPress);
XISetMask (mask.mask, XI_ButtonRelease);
@ -1872,7 +1873,9 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
meta_error_trap_pop (display);
meta_cursor_tracker_set_grab_cursor (screen->cursor_tracker, cursor);
cursor_ref = meta_cursor_reference_from_theme (screen->cursor_tracker, cursor);
meta_cursor_tracker_set_grab_cursor (screen->cursor_tracker, cursor_ref);
meta_cursor_reference_unref (cursor_ref);
}
gboolean
@ -2111,7 +2114,7 @@ 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, META_CURSOR_DEFAULT);
meta_cursor_tracker_set_grab_cursor (display->screen->cursor_tracker, NULL);
display->grab_timestamp = 0;
display->grab_window = NULL;

View File

@ -80,8 +80,8 @@ struct _MetaCursorTrackerClass {
gboolean meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
XEvent *xevent);
void meta_cursor_tracker_set_grab_cursor (MetaCursorTracker *tracker,
MetaCursor cursor);
void meta_cursor_tracker_set_grab_cursor (MetaCursorTracker *tracker,
MetaCursorReference *cursor);
void meta_cursor_tracker_set_window_cursor (MetaCursorTracker *tracker,
struct wl_resource *buffer,
int hot_x,

View File

@ -372,12 +372,13 @@ meta_cursor_tracker_get_hot (MetaCursorTracker *tracker,
}
void
meta_cursor_tracker_set_grab_cursor (MetaCursorTracker *tracker,
MetaCursor cursor)
meta_cursor_tracker_set_grab_cursor (MetaCursorTracker *tracker,
MetaCursorReference *cursor)
{
g_clear_pointer (&tracker->grab_cursor, meta_cursor_reference_unref);
if (cursor != META_CURSOR_DEFAULT)
tracker->grab_cursor = meta_cursor_reference_from_theme (tracker, cursor);
if (cursor)
tracker->grab_cursor = meta_cursor_reference_ref (cursor);
sync_cursor (tracker);
}