Allow to update the cursor hotspot without its pixels

This commit is contained in:
emersion 2017-10-12 09:40:51 +02:00
parent 5c6a933890
commit 92daa790bb
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
5 changed files with 34 additions and 11 deletions

View file

@ -127,7 +127,7 @@ static bool set_cursor(struct wlr_output *output, const uint8_t *buf,
int32_t hotspot_y) {
if (output->impl->set_cursor
&& output->impl->set_cursor(output, buf, stride, width, height,
hotspot_x, hotspot_y)) {
hotspot_x, hotspot_y, true)) {
output->cursor.is_sw = false;
return true;
}
@ -238,6 +238,15 @@ void wlr_output_set_cursor_surface(struct wlr_output *output,
output->cursor.hotspot_x = hotspot_x;
output->cursor.hotspot_y = hotspot_y;
if (surface && surface == output->cursor.surface) {
if (output->impl->set_cursor && !output->cursor.is_sw) {
// Only update the hotspot
output->impl->set_cursor(output, NULL, 0, 0, 0, hotspot_x,
hotspot_y, false);
}
return;
}
if (output->cursor.surface) {
wl_list_remove(&output->cursor.surface_commit.link);
wl_list_remove(&output->cursor.surface_destroy.link);

View file

@ -427,8 +427,9 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
// TODO: add the invalid bitfield to this callback
wl_signal_emit(&surface->events.commit, surface);
// TODO: call this
//wlr_surface_state_release_buffer(surface->current);
// Release the buffer after calling commit, because some listeners
// might need it (e.g. for cursor surfaces)
wlr_surface_state_release_buffer(surface->current);
}
static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) {