Exemplo n.º 1
0
static void
_eventd_nd_cursor_frame_callback(void *data, struct wl_callback *callback, uint32_t time)
{
    EventdNdBackendContext *self = data;
    int i;

    if ( self->cursor.frame_cb != NULL )
        wl_callback_destroy(self->cursor.frame_cb);
    self->cursor.frame_cb = wl_surface_frame(self->cursor.surface);
    wl_callback_add_listener(self->cursor.frame_cb, &_eventd_nd_cursor_frame_wl_callback_listener, self);

    i = wl_cursor_frame(self->cursor.cursor, time);
    _eventd_nd_cursor_set_image(self, i);
}
Exemplo n.º 2
0
static void
surface_frame_done(void *data, struct wl_callback *wl_callback, uint32_t time)
{
    struct wl_cursor_image *cursor_image;
    struct wl_buffer *cursor_buffer = NULL;
    struct cursor_surface *cursor = (struct cursor_surface *)data;
    int image_index = wl_cursor_frame(cursor->cursor, time);

    cursor_image = cursor->cursor->images[image_index];
    cursor_buffer = wl_cursor_image_get_buffer(cursor_image);

    if (cursor->frame)
        wl_callback_destroy(cursor->frame);
    cursor->frame = wl_surface_frame(cursor->surface);
    wl_callback_add_listener(cursor->frame, &frame_listener, cursor);
    wl_surface_attach(cursor->surface, cursor_buffer, 0, 0);
    wl_surface_damage(cursor->surface, 0, 0, cursor_image->width, cursor_image->height);
    wl_surface_commit(cursor->surface);
}