Do not commit surface on set_cursor, breaks GTK+ apps

This commit is contained in:
emersion 2017-10-09 15:45:46 +02:00
parent b76e64e7bf
commit 8f7962ed44
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 6 additions and 13 deletions

View File

@ -171,8 +171,12 @@ bool wlr_output_set_cursor(struct wlr_output *output,
return set_cursor(output, buf, stride, width, height, hotspot_x, hotspot_y); return set_cursor(output, buf, stride, width, height, hotspot_x, hotspot_y);
} }
static void commit_cursor_surface(struct wlr_output *output, static void handle_cursor_surface_commit(struct wl_listener *listener,
struct wlr_surface *surface) { void *data) {
struct wlr_output *output = wl_container_of(listener, output,
cursor.surface_commit);
struct wlr_surface *surface = data;
struct wl_shm_buffer *buffer = wl_shm_buffer_get(surface->current->buffer); struct wl_shm_buffer *buffer = wl_shm_buffer_get(surface->current->buffer);
if (buffer == NULL) { if (buffer == NULL) {
return; return;
@ -194,15 +198,6 @@ static void commit_cursor_surface(struct wlr_output *output,
wl_shm_buffer_end_access(buffer); wl_shm_buffer_end_access(buffer);
} }
static void handle_cursor_surface_commit(struct wl_listener *listener,
void *data) {
struct wlr_output *output = wl_container_of(listener, output,
cursor.surface_commit);
struct wlr_surface *surface = data;
commit_cursor_surface(output, surface);
}
static void handle_cursor_surface_destroy(struct wl_listener *listener, static void handle_cursor_surface_destroy(struct wl_listener *listener,
void *data) { void *data) {
struct wlr_output *output = wl_container_of(listener, output, struct wlr_output *output = wl_container_of(listener, output,
@ -223,7 +218,6 @@ void wlr_output_set_cursor_surface(struct wlr_output *output,
output->cursor.hotspot_y = hotspot_y; output->cursor.hotspot_y = hotspot_y;
if (surface && output->cursor.surface == surface) { if (surface && output->cursor.surface == surface) {
commit_cursor_surface(output, surface);
return; return;
} }
@ -238,7 +232,6 @@ void wlr_output_set_cursor_surface(struct wlr_output *output,
if (surface != NULL) { if (surface != NULL) {
wl_signal_add(&surface->events.commit, &output->cursor.surface_commit); wl_signal_add(&surface->events.commit, &output->cursor.surface_commit);
wl_signal_add(&surface->events.destroy, &output->cursor.surface_destroy); wl_signal_add(&surface->events.destroy, &output->cursor.surface_destroy);
commit_cursor_surface(output, surface);
} else { } else {
set_cursor(output, NULL, 0, 0, 0, hotspot_x, hotspot_y); set_cursor(output, NULL, 0, 0, 0, hotspot_x, hotspot_y);
} }