diff --git a/kiwmi/desktop/output.c b/kiwmi/desktop/output.c index b40abd1..ea697af 100644 --- a/kiwmi/desktop/output.c +++ b/kiwmi/desktop/output.c @@ -137,6 +137,18 @@ send_frame_done_to_surface( wlr_surface_send_frame_done(surface, now); } +static bool +render_cursors(struct wlr_output *wlr_output) +{ + pixman_region32_t damage; + pixman_region32_init(&damage); + wlr_output_render_software_cursors(wlr_output, &damage); + bool damaged = pixman_region32_not_empty(&damage); + pixman_region32_fini(&damage); + + return damaged; +} + static void output_frame_notify(struct wl_listener *listener, void *data) { @@ -147,8 +159,6 @@ output_frame_notify(struct wl_listener *listener, void *data) struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); - printf("%d\n", output->damaged); - if (output->damaged == 0) { send_frame_done_to_layer( &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &now); @@ -169,6 +179,10 @@ output_frame_notify(struct wl_listener *listener, void *data) return; } + if (render_cursors(wlr_output)) { + output->damaged = 2; + } + wlr_output_commit(wlr_output); return; } @@ -221,7 +235,10 @@ output_frame_notify(struct wl_listener *listener, void *data) render_layer(&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &rdata); render_layer(&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &rdata); - wlr_output_render_software_cursors(wlr_output, NULL); + if (render_cursors(wlr_output)) { + output->damaged = 3; + } + wlr_renderer_end(renderer); --output->damaged; diff --git a/kiwmi/input/cursor.c b/kiwmi/input/cursor.c index 5c23076..dd801b1 100644 --- a/kiwmi/input/cursor.c +++ b/kiwmi/input/cursor.c @@ -126,10 +126,6 @@ process_cursor_motion(struct kiwmi_server *server, uint32_t time) } else { wlr_seat_pointer_clear_focus(seat); } - - wl_list_for_each (output, &server->desktop.outputs, link) { - output->damaged = 2; - } } static void