From be60e4f6e76574fe1023b3d18b0b0fd2c62586ac Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 31 Mar 2014 16:50:15 -0400 Subject: [PATCH] cursor-tracker: Make set_window_cursor take a MetaCursorReference as well --- src/core/meta-cursor-tracker-private.h | 12 +++++------- src/core/meta-cursor-tracker.c | 13 ++----------- src/wayland/meta-wayland-seat.c | 20 +++++++++++++------- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/src/core/meta-cursor-tracker-private.h b/src/core/meta-cursor-tracker-private.h index ced31b3c1..f236b3494 100644 --- a/src/core/meta-cursor-tracker-private.h +++ b/src/core/meta-cursor-tracker-private.h @@ -82,13 +82,11 @@ gboolean meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker, 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, - int hot_y); -void meta_cursor_tracker_unset_window_cursor (MetaCursorTracker *tracker); -void meta_cursor_tracker_set_root_cursor (MetaCursorTracker *tracker, - MetaCursor cursor); +void meta_cursor_tracker_set_window_cursor (MetaCursorTracker *tracker, + MetaCursorReference *cursor); +void meta_cursor_tracker_unset_window_cursor (MetaCursorTracker *tracker); +void meta_cursor_tracker_set_root_cursor (MetaCursorTracker *tracker, + MetaCursor cursor); void meta_cursor_tracker_update_position (MetaCursorTracker *tracker, int new_x, diff --git a/src/core/meta-cursor-tracker.c b/src/core/meta-cursor-tracker.c index beaf25594..8b6561eae 100644 --- a/src/core/meta-cursor-tracker.c +++ b/src/core/meta-cursor-tracker.c @@ -383,18 +383,9 @@ meta_cursor_tracker_set_grab_cursor (MetaCursorTracker *tracker, } void -meta_cursor_tracker_set_window_cursor (MetaCursorTracker *tracker, - struct wl_resource *buffer, - int hot_x, - int hot_y) +meta_cursor_tracker_set_window_cursor (MetaCursorTracker *tracker, + MetaCursorReference *cursor) { - MetaCursorReference *cursor; - - if (buffer) - cursor = meta_cursor_reference_from_buffer (tracker, buffer, hot_x, hot_y); - else - cursor = NULL; - set_window_cursor (tracker, TRUE, cursor); } diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c index 8ec7b2b75..2d5f0fbb9 100644 --- a/src/wayland/meta-wayland-seat.c +++ b/src/wayland/meta-wayland-seat.c @@ -68,20 +68,26 @@ set_cursor_surface (MetaWaylandSeat *seat, void meta_wayland_seat_update_cursor_surface (MetaWaylandSeat *seat) { - struct wl_resource *buffer; + MetaCursorReference *cursor; if (seat->cursor_tracker == NULL) return; if (seat->cursor_surface && seat->cursor_surface->buffer) - buffer = seat->cursor_surface->buffer->resource; + { + struct wl_resource *buffer = seat->cursor_surface->buffer->resource; + cursor = meta_cursor_reference_from_buffer (seat->cursor_tracker, + buffer, + seat->hotspot_x, + seat->hotspot_y); + } else - buffer = NULL; + cursor = NULL; - meta_cursor_tracker_set_window_cursor (seat->cursor_tracker, - buffer, - seat->hotspot_x, - seat->hotspot_y); + meta_cursor_tracker_set_window_cursor (seat->cursor_tracker, cursor); + + if (cursor) + meta_cursor_reference_unref (cursor); } static void