diff --git a/src/core/display.c b/src/core/display.c index b4c5b2bce..716f864f9 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -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; diff --git a/src/core/meta-cursor-tracker-private.h b/src/core/meta-cursor-tracker-private.h index 9da347a3c..ced31b3c1 100644 --- a/src/core/meta-cursor-tracker-private.h +++ b/src/core/meta-cursor-tracker-private.h @@ -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, diff --git a/src/core/meta-cursor-tracker.c b/src/core/meta-cursor-tracker.c index ebc661b8a..beaf25594 100644 --- a/src/core/meta-cursor-tracker.c +++ b/src/core/meta-cursor-tracker.c @@ -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); }