Better placement of visibility check

This commit is contained in:
ixru 2018-10-08 15:58:24 +02:00
parent 6a9995d18c
commit 8d0997a5e7

View file

@ -853,6 +853,7 @@ static void output_cursor_commit(struct wlr_output_cursor *cursor,
cursor->enabled = wlr_surface_has_buffer(surface);
cursor->width = surface->current.width * cursor->output->scale;
cursor->height = surface->current.height * cursor->output->scale;
output_cursor_update_visible(cursor);
if (update_hotspot) {
cursor->hotspot_x -= surface->current.dx * cursor->output->scale;
cursor->hotspot_y -= surface->current.dy * cursor->output->scale;
@ -874,7 +875,6 @@ static void output_cursor_handle_commit(struct wl_listener *listener,
struct wlr_output_cursor *cursor =
wl_container_of(listener, cursor, surface_commit);
output_cursor_commit(cursor, true);
output_cursor_update_visible(cursor);
}
static void output_cursor_handle_destroy(struct wl_listener *listener,
@ -916,10 +916,9 @@ void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
if (surface != NULL) {
wl_signal_add(&surface->events.commit, &cursor->surface_commit);
wl_signal_add(&surface->events.destroy, &cursor->surface_destroy);
output_cursor_commit(cursor, false);
cursor->visible = false;
output_cursor_update_visible(cursor);
output_cursor_commit(cursor, false);
} else {
cursor->enabled = false;
cursor->width = 0;