From 99743e7e2bbc425f3259595084d87d95078a9a0e Mon Sep 17 00:00:00 2001 From: buffet Date: Sat, 14 Aug 2021 20:25:15 +0000 Subject: [PATCH] Redraw twice on damage (even more hacky) --- include/desktop/output.h | 2 +- kiwmi/desktop/layer_shell.c | 6 +++--- kiwmi/desktop/output.c | 16 ++++++++-------- kiwmi/desktop/view.c | 4 ++-- kiwmi/desktop/xdg_shell.c | 6 +++--- kiwmi/input/cursor.c | 2 +- kiwmi/input/seat.c | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/desktop/output.h b/include/desktop/output.h index b27d41a..a6e6dd1 100644 --- a/include/desktop/output.h +++ b/include/desktop/output.h @@ -23,7 +23,7 @@ struct kiwmi_output { struct wl_list layers[4]; // struct kiwmi_layer_surface::link struct wlr_box usable_area; - bool damaged; + int damaged; struct { struct wl_signal destroy; diff --git a/kiwmi/desktop/layer_shell.c b/kiwmi/desktop/layer_shell.c index 405f70f..399da57 100644 --- a/kiwmi/desktop/layer_shell.c +++ b/kiwmi/desktop/layer_shell.c @@ -54,7 +54,7 @@ kiwmi_layer_commit_notify(struct wl_listener *listener, void *UNUSED(data)) } if (layer_changed || geom_changed) { - output->damaged = true; + output->damaged = 2; } } @@ -63,7 +63,7 @@ kiwmi_layer_map_notify(struct wl_listener *listener, void *UNUSED(data)) { struct kiwmi_layer *layer = wl_container_of(listener, layer, map); - layer->output->damaged = true; + layer->output->damaged = 2; } static void @@ -71,7 +71,7 @@ kiwmi_layer_unmap_notify(struct wl_listener *listener, void *UNUSED(data)) { struct kiwmi_layer *layer = wl_container_of(listener, layer, unmap); - layer->output->damaged = true; + layer->output->damaged = 2; } static void diff --git a/kiwmi/desktop/output.c b/kiwmi/desktop/output.c index 47794af..9096827 100644 --- a/kiwmi/desktop/output.c +++ b/kiwmi/desktop/output.c @@ -40,7 +40,7 @@ render_layer_surface(struct wlr_surface *surface, int x, int y, void *data) return; } - if (!output->damaged) { + if (output->damaged == 0) { wlr_surface_send_frame_done(surface, rdata->when); return; } @@ -91,7 +91,7 @@ render_surface(struct wlr_surface *surface, int sx, int sy, void *data) return; } - if (!output->damaged) { + if (output->damaged == 0) { wlr_surface_send_frame_done(surface, rdata->when); return; } @@ -140,7 +140,7 @@ output_frame_notify(struct wl_listener *listener, void *data) wlr_output_effective_resolution(wlr_output, &width, &height); wlr_renderer_begin(renderer, width, height); - if (output->damaged) { + if (output->damaged > 0) { wlr_renderer_clear(renderer, desktop->bg_color); } @@ -168,7 +168,7 @@ output_frame_notify(struct wl_listener *listener, void *data) rdata.data = view; - if (output->damaged) { + if (output->damaged > 0) { wl_signal_emit(&view->events.pre_render, &rdata); view_for_each_surface(view, render_surface, &rdata); wl_signal_emit(&view->events.post_render, &rdata); @@ -183,7 +183,7 @@ output_frame_notify(struct wl_listener *listener, void *data) wlr_output_render_software_cursors(wlr_output, NULL); wlr_renderer_end(renderer); - output->damaged = false; + --output->damaged; wlr_output_commit(wlr_output); } @@ -196,7 +196,7 @@ output_commit_notify(struct wl_listener *listener, void *data) if (event->committed & WLR_OUTPUT_STATE_TRANSFORM) { arrange_layers(output); - output->damaged = true; + output->damaged = 2; wl_signal_emit(&output->events.resize, output); } @@ -225,7 +225,7 @@ output_mode_notify(struct wl_listener *listener, void *UNUSED(data)) struct kiwmi_output *output = wl_container_of(listener, output, mode); arrange_layers(output); - output->damaged = true; + output->damaged = 2; wl_signal_emit(&output->events.resize, output); } @@ -244,7 +244,7 @@ output_create(struct wlr_output *wlr_output, struct kiwmi_desktop *desktop) output->usable_area.width = wlr_output->width; output->usable_area.height = wlr_output->height; - output->damaged = true; + output->damaged = 2; output->frame.notify = output_frame_notify; wl_signal_add(&wlr_output->events.frame, &output->frame); diff --git a/kiwmi/desktop/view.c b/kiwmi/desktop/view.c index 67f0f81..f30e47b 100644 --- a/kiwmi/desktop/view.c +++ b/kiwmi/desktop/view.c @@ -88,7 +88,7 @@ view_set_size(struct kiwmi_view *view, uint32_t width, uint32_t height) struct kiwmi_output *output; wl_list_for_each (output, &view->desktop->outputs, link) { - output->damaged = true; + output->damaged = 2; } } } @@ -101,7 +101,7 @@ view_set_pos(struct kiwmi_view *view, uint32_t x, uint32_t y) struct kiwmi_output *output; wl_list_for_each (output, &view->desktop->outputs, link) { - output->damaged = true; + output->damaged = 2; } } diff --git a/kiwmi/desktop/xdg_shell.c b/kiwmi/desktop/xdg_shell.c index 88b9bd6..628d8c3 100644 --- a/kiwmi/desktop/xdg_shell.c +++ b/kiwmi/desktop/xdg_shell.c @@ -28,7 +28,7 @@ xdg_surface_map_notify(struct wl_listener *listener, void *UNUSED(data)) struct kiwmi_output *output; wl_list_for_each (output, &view->desktop->outputs, link) { - output->damaged = true; + output->damaged = 2; } wl_signal_emit(&view->desktop->events.view_map, view); @@ -44,7 +44,7 @@ xdg_surface_unmap_notify(struct wl_listener *listener, void *UNUSED(data)) struct kiwmi_output *output; wl_list_for_each (output, &view->desktop->outputs, link) { - output->damaged = true; + output->damaged = 2; } wl_signal_emit(&view->events.unmap, view); @@ -59,7 +59,7 @@ xdg_surface_commit_notify(struct wl_listener *listener, void *UNUSED(data)) if (pixman_region32_not_empty(&view->wlr_surface->buffer_damage)) { struct kiwmi_output *output; wl_list_for_each (output, &view->desktop->outputs, link) { - output->damaged = true; + output->damaged = 2; } } diff --git a/kiwmi/input/cursor.c b/kiwmi/input/cursor.c index f27d10c..8ccc046 100644 --- a/kiwmi/input/cursor.c +++ b/kiwmi/input/cursor.c @@ -128,7 +128,7 @@ process_cursor_motion(struct kiwmi_server *server, uint32_t time) } wl_list_for_each (output, &server->desktop.outputs, link) { - output->damaged = true; + output->damaged = 2; } } diff --git a/kiwmi/input/seat.c b/kiwmi/input/seat.c index be50c60..09c29c5 100644 --- a/kiwmi/input/seat.c +++ b/kiwmi/input/seat.c @@ -116,7 +116,7 @@ request_set_cursor_notify(struct wl_listener *listener, void *data) struct kiwmi_output *output; wl_list_for_each (output, &server->desktop.outputs, link) { - output->damaged = true; + output->damaged = 2; } wlr_cursor_set_surface(