This just adds an entry point to set a specific frame of an animated cursor.
-input_set_pointer_image(struct input *input, int pointer)
+input_set_pointer_image_index(struct input *input, int pointer, int index)
{
struct wl_buffer *buffer;
struct wl_cursor *cursor;
struct wl_cursor_image *image;
{
struct wl_buffer *buffer;
struct wl_cursor *cursor;
struct wl_cursor_image *image;
- if (pointer == input->current_cursor)
- return;
-
cursor = input->display->cursors[pointer];
if (!cursor)
return;
cursor = input->display->cursors[pointer];
if (!cursor)
return;
- image = cursor->images[0];
+ if (index >= (int) cursor->image_count) {
+ fprintf(stderr, "cursor index out of range\n");
+ return;
+ }
+
+ image = cursor->images[index];
buffer = wl_cursor_image_get_buffer(image);
if (!buffer)
return;
buffer = wl_cursor_image_get_buffer(image);
if (!buffer)
return;
buffer, image->hotspot_x, image->hotspot_y);
}
buffer, image->hotspot_x, image->hotspot_y);
}
+void
+input_set_pointer_image(struct input *input, int pointer)
+{
+ if (pointer == input->current_cursor)
+ return;
+
+ input_set_pointer_image_index(input, pointer, 0);
+}
+
struct wl_data_device *
input_get_data_device(struct input *input)
{
struct wl_data_device *
input_get_data_device(struct input *input)
{
input_set_pointer_image(struct input *input, int pointer);
void
input_set_pointer_image(struct input *input, int pointer);
void
+input_set_pointer_image_index(struct input *input, int pointer, int index);
+
+void
input_get_position(struct input *input, int32_t *x, int32_t *y);
#define MOD_SHIFT_MASK 0x01
input_get_position(struct input *input, int32_t *x, int32_t *y);
#define MOD_SHIFT_MASK 0x01