Move stuff into output_damage() function

This commit is contained in:
buffet 2021-08-15 17:07:54 +00:00
parent 6e5e651f90
commit 1cb890c45e
6 changed files with 30 additions and 19 deletions

View file

@ -43,4 +43,6 @@ struct kiwmi_render_data {
void new_output_notify(struct wl_listener *listener, void *data); void new_output_notify(struct wl_listener *listener, void *data);
void output_damage(struct kiwmi_output *output);
#endif /* KIWMI_DESKTOP_OUTPUT_H */ #endif /* KIWMI_DESKTOP_OUTPUT_H */

View file

@ -15,6 +15,7 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "desktop/desktop.h" #include "desktop/desktop.h"
#include "desktop/output.h"
#include "input/seat.h" #include "input/seat.h"
#include "server.h" #include "server.h"
@ -57,7 +58,7 @@ kiwmi_layer_commit_notify(struct wl_listener *listener, void *UNUSED(data))
} }
if (buffer_changed || layer_changed || geom_changed) { if (buffer_changed || layer_changed || geom_changed) {
output->damaged = 2; output_damage(layer->output);
} }
} }
@ -66,7 +67,7 @@ kiwmi_layer_map_notify(struct wl_listener *listener, void *UNUSED(data))
{ {
struct kiwmi_layer *layer = wl_container_of(listener, layer, map); struct kiwmi_layer *layer = wl_container_of(listener, layer, map);
layer->output->damaged = 2; output_damage(layer->output);
} }
static void static void
@ -74,7 +75,7 @@ kiwmi_layer_unmap_notify(struct wl_listener *listener, void *UNUSED(data))
{ {
struct kiwmi_layer *layer = wl_container_of(listener, layer, unmap); struct kiwmi_layer *layer = wl_container_of(listener, layer, unmap);
layer->output->damaged = 2; output_damage(layer->output);
} }
static void static void

View file

@ -181,7 +181,7 @@ output_frame_notify(struct wl_listener *listener, void *data)
} }
if (render_cursors(wlr_output)) { if (render_cursors(wlr_output)) {
output->damaged = 2; output_damage(output);
} }
wlr_output_commit(wlr_output); wlr_output_commit(wlr_output);
@ -236,13 +236,14 @@ 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);
if (render_cursors(wlr_output)) { bool damaged = render_cursors(wlr_output);
output->damaged = 3;
}
wlr_renderer_end(renderer); wlr_renderer_end(renderer);
--output->damaged; if (damaged) {
output_damage(output);
} else {
--output->damaged;
}
wlr_output_commit(wlr_output); wlr_output_commit(wlr_output);
} }
@ -255,7 +256,7 @@ output_commit_notify(struct wl_listener *listener, void *data)
if (event->committed & WLR_OUTPUT_STATE_TRANSFORM) { if (event->committed & WLR_OUTPUT_STATE_TRANSFORM) {
arrange_layers(output); arrange_layers(output);
output->damaged = 2; output_damage(output);
wl_signal_emit(&output->events.resize, output); wl_signal_emit(&output->events.resize, output);
} }
@ -284,7 +285,7 @@ output_mode_notify(struct wl_listener *listener, void *UNUSED(data))
struct kiwmi_output *output = wl_container_of(listener, output, mode); struct kiwmi_output *output = wl_container_of(listener, output, mode);
arrange_layers(output); arrange_layers(output);
output->damaged = 2; output_damage(output);
wl_signal_emit(&output->events.resize, output); wl_signal_emit(&output->events.resize, output);
} }
@ -303,8 +304,6 @@ output_create(struct wlr_output *wlr_output, struct kiwmi_desktop *desktop)
output->usable_area.width = wlr_output->width; output->usable_area.width = wlr_output->width;
output->usable_area.height = wlr_output->height; output->usable_area.height = wlr_output->height;
output->damaged = 2;
output->frame.notify = output_frame_notify; output->frame.notify = output_frame_notify;
wl_signal_add(&wlr_output->events.frame, &output->frame); wl_signal_add(&wlr_output->events.frame, &output->frame);
@ -317,6 +316,8 @@ output_create(struct wlr_output *wlr_output, struct kiwmi_desktop *desktop)
output->mode.notify = output_mode_notify; output->mode.notify = output_mode_notify;
wl_signal_add(&wlr_output->events.mode, &output->mode); wl_signal_add(&wlr_output->events.mode, &output->mode);
output_damage(output);
return output; return output;
} }
@ -370,3 +371,9 @@ new_output_notify(struct wl_listener *listener, void *data)
wl_signal_emit(&desktop->events.new_output, output); wl_signal_emit(&desktop->events.new_output, output);
} }
void
output_damage(struct kiwmi_output *output)
{
output->damaged = 2;
}

View file

@ -88,7 +88,7 @@ view_set_size(struct kiwmi_view *view, uint32_t width, uint32_t height)
struct kiwmi_output *output; struct kiwmi_output *output;
wl_list_for_each (output, &view->desktop->outputs, link) { wl_list_for_each (output, &view->desktop->outputs, link) {
output->damaged = 2; output_damage(output);
} }
} }
} }
@ -101,7 +101,7 @@ view_set_pos(struct kiwmi_view *view, uint32_t x, uint32_t y)
struct kiwmi_output *output; struct kiwmi_output *output;
wl_list_for_each (output, &view->desktop->outputs, link) { wl_list_for_each (output, &view->desktop->outputs, link) {
output->damaged = 2; output_damage(output);
} }
} }

View file

@ -16,6 +16,7 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "desktop/desktop.h" #include "desktop/desktop.h"
#include "desktop/output.h"
#include "desktop/view.h" #include "desktop/view.h"
#include "input/input.h" #include "input/input.h"
#include "input/seat.h" #include "input/seat.h"
@ -29,7 +30,7 @@ xdg_surface_map_notify(struct wl_listener *listener, void *UNUSED(data))
struct kiwmi_output *output; struct kiwmi_output *output;
wl_list_for_each (output, &view->desktop->outputs, link) { wl_list_for_each (output, &view->desktop->outputs, link) {
output->damaged = 2; output_damage(output);
} }
wl_signal_emit(&view->desktop->events.view_map, view); wl_signal_emit(&view->desktop->events.view_map, view);
@ -45,7 +46,7 @@ xdg_surface_unmap_notify(struct wl_listener *listener, void *UNUSED(data))
struct kiwmi_output *output; struct kiwmi_output *output;
wl_list_for_each (output, &view->desktop->outputs, link) { wl_list_for_each (output, &view->desktop->outputs, link) {
output->damaged = 2; output_damage(output);
} }
wl_signal_emit(&view->events.unmap, view); wl_signal_emit(&view->events.unmap, view);
@ -60,7 +61,7 @@ xdg_surface_commit_notify(struct wl_listener *listener, void *UNUSED(data))
if (pixman_region32_not_empty(&view->wlr_surface->buffer_damage)) { if (pixman_region32_not_empty(&view->wlr_surface->buffer_damage)) {
struct kiwmi_output *output; struct kiwmi_output *output;
wl_list_for_each (output, &view->desktop->outputs, link) { wl_list_for_each (output, &view->desktop->outputs, link) {
output->damaged = 2; output_damage(output);
} }
} }

View file

@ -116,7 +116,7 @@ request_set_cursor_notify(struct wl_listener *listener, void *data)
struct kiwmi_output *output; struct kiwmi_output *output;
wl_list_for_each (output, &server->desktop.outputs, link) { wl_list_for_each (output, &server->desktop.outputs, link) {
output->damaged = 2; output_damage(output);
} }
wlr_cursor_set_surface( wlr_cursor_set_surface(