cursor-tracker: Make set_window_cursor take a MetaCursorReference as well

This commit is contained in:
Jasper St. Pierre 2014-03-31 16:50:15 -04:00
parent fa60824096
commit be60e4f6e7
3 changed files with 20 additions and 25 deletions

View File

@ -83,9 +83,7 @@ gboolean meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
void meta_cursor_tracker_set_grab_cursor (MetaCursorTracker *tracker, void meta_cursor_tracker_set_grab_cursor (MetaCursorTracker *tracker,
MetaCursorReference *cursor); MetaCursorReference *cursor);
void meta_cursor_tracker_set_window_cursor (MetaCursorTracker *tracker, void meta_cursor_tracker_set_window_cursor (MetaCursorTracker *tracker,
struct wl_resource *buffer, MetaCursorReference *cursor);
int hot_x,
int hot_y);
void meta_cursor_tracker_unset_window_cursor (MetaCursorTracker *tracker); void meta_cursor_tracker_unset_window_cursor (MetaCursorTracker *tracker);
void meta_cursor_tracker_set_root_cursor (MetaCursorTracker *tracker, void meta_cursor_tracker_set_root_cursor (MetaCursorTracker *tracker,
MetaCursor cursor); MetaCursor cursor);

View File

@ -384,17 +384,8 @@ meta_cursor_tracker_set_grab_cursor (MetaCursorTracker *tracker,
void void
meta_cursor_tracker_set_window_cursor (MetaCursorTracker *tracker, meta_cursor_tracker_set_window_cursor (MetaCursorTracker *tracker,
struct wl_resource *buffer, MetaCursorReference *cursor)
int hot_x,
int hot_y)
{ {
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); set_window_cursor (tracker, TRUE, cursor);
} }

View File

@ -68,21 +68,27 @@ set_cursor_surface (MetaWaylandSeat *seat,
void void
meta_wayland_seat_update_cursor_surface (MetaWaylandSeat *seat) meta_wayland_seat_update_cursor_surface (MetaWaylandSeat *seat)
{ {
struct wl_resource *buffer; MetaCursorReference *cursor;
if (seat->cursor_tracker == NULL) if (seat->cursor_tracker == NULL)
return; return;
if (seat->cursor_surface && seat->cursor_surface->buffer) if (seat->cursor_surface && seat->cursor_surface->buffer)
buffer = seat->cursor_surface->buffer->resource; {
else struct wl_resource *buffer = seat->cursor_surface->buffer->resource;
buffer = NULL; cursor = meta_cursor_reference_from_buffer (seat->cursor_tracker,
meta_cursor_tracker_set_window_cursor (seat->cursor_tracker,
buffer, buffer,
seat->hotspot_x, seat->hotspot_x,
seat->hotspot_y); seat->hotspot_y);
} }
else
cursor = NULL;
meta_cursor_tracker_set_window_cursor (seat->cursor_tracker, cursor);
if (cursor)
meta_cursor_reference_unref (cursor);
}
static void static void
pointer_set_cursor (struct wl_client *client, pointer_set_cursor (struct wl_client *client,