From 4bf66b6df57bba336d870e17a94d67cd1f483f82 Mon Sep 17 00:00:00 2001 From: Charlotte Meyer 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 ed3dfc8..8794ae2 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 3ac69fb..a3bd08a 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 b1f400d..25f14db 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 3d5d7f3..1ccf00d 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 4217b72..b731d5c 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 4ac0286..5c23076 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 d897361..73d5d8f 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(