Don't redraw on cursor movements unless required
This commit is contained in:
parent
c6012cf08b
commit
c54abdba2c
2 changed files with 20 additions and 7 deletions
|
@ -137,6 +137,18 @@ send_frame_done_to_surface(
|
||||||
wlr_surface_send_frame_done(surface, now);
|
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
|
static void
|
||||||
output_frame_notify(struct wl_listener *listener, void *data)
|
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;
|
struct timespec now;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
|
|
||||||
printf("%d\n", output->damaged);
|
|
||||||
|
|
||||||
if (output->damaged == 0) {
|
if (output->damaged == 0) {
|
||||||
send_frame_done_to_layer(
|
send_frame_done_to_layer(
|
||||||
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &now);
|
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &now);
|
||||||
|
@ -169,6 +179,10 @@ output_frame_notify(struct wl_listener *listener, void *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (render_cursors(wlr_output)) {
|
||||||
|
output->damaged = 2;
|
||||||
|
}
|
||||||
|
|
||||||
wlr_output_commit(wlr_output);
|
wlr_output_commit(wlr_output);
|
||||||
return;
|
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_TOP], &rdata);
|
||||||
render_layer(&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &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);
|
wlr_renderer_end(renderer);
|
||||||
|
|
||||||
--output->damaged;
|
--output->damaged;
|
||||||
|
|
|
@ -126,10 +126,6 @@ process_cursor_motion(struct kiwmi_server *server, uint32_t time)
|
||||||
} else {
|
} else {
|
||||||
wlr_seat_pointer_clear_focus(seat);
|
wlr_seat_pointer_clear_focus(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_for_each (output, &server->desktop.outputs, link) {
|
|
||||||
output->damaged = 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue