diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index bc05dfbf..2c28e82f 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -63,6 +63,7 @@ struct wlr_output { int32_t refresh; // mHz struct { + struct wl_signal damage; struct wl_signal frame; struct wl_signal swap_buffers; struct wl_signal enable; diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index 2dd64176..32f2eb02 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -107,9 +107,6 @@ static void init_globals() { static void wlr_gles2_begin(struct wlr_renderer *_renderer, struct wlr_output *output) { - // TODO: let users customize the clear color? - //GL_CALL(glClearColor(0.25f, 0.25f, 0.25f, 1)); - //GL_CALL(glClear(GL_COLOR_BUFFER_BIT)); GL_CALL(glViewport(0, 0, output->width, output->height)); // enable transparency diff --git a/types/wlr_output.c b/types/wlr_output.c index dfcba906..bf02967c 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -272,6 +272,7 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, output->scale = 1; wl_list_init(&output->cursors); wl_list_init(&output->wl_resources); + wl_signal_init(&output->events.damage); wl_signal_init(&output->events.frame); wl_signal_init(&output->events.swap_buffers); wl_signal_init(&output->events.enable); @@ -494,6 +495,7 @@ uint32_t wlr_output_get_gamma_size(struct wlr_output *output) { static void output_damage_whole(struct wlr_output *output) { pixman_region32_union_rect(&output->damage, &output->damage, 0, 0, output->width, output->height); + wl_signal_emit(&output->events.damage, output); } static void output_fullscreen_surface_reset(struct wlr_output *output) { @@ -520,6 +522,8 @@ static void output_fullscreen_surface_handle_commit( pixman_region32_translate(&damage, box.x, box.y); pixman_region32_union(&output->damage, &output->damage, &damage); pixman_region32_fini(&damage); + + wl_signal_emit(&output->events.damage, output); } static void output_fullscreen_surface_handle_destroy( @@ -561,6 +565,7 @@ static void output_cursor_damage_whole(struct wlr_output_cursor *cursor) { output_cursor_get_box(cursor, &box); pixman_region32_union_rect(&cursor->output->damage, &cursor->output->damage, box.x, box.y, box.width, box.height); + wl_signal_emit(&cursor->output->events.damage, cursor->output); } static void output_cursor_reset(struct wlr_output_cursor *cursor) {