Redraw twice on damage (even more hacky)
This commit is contained in:
parent
64aad5b332
commit
4bf66b6df5
7 changed files with 19 additions and 19 deletions
|
@ -23,7 +23,7 @@ struct kiwmi_output {
|
||||||
struct wl_list layers[4]; // struct kiwmi_layer_surface::link
|
struct wl_list layers[4]; // struct kiwmi_layer_surface::link
|
||||||
struct wlr_box usable_area;
|
struct wlr_box usable_area;
|
||||||
|
|
||||||
bool damaged;
|
int damaged;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
|
|
|
@ -54,7 +54,7 @@ kiwmi_layer_commit_notify(struct wl_listener *listener, void *UNUSED(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layer_changed || geom_changed) {
|
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);
|
struct kiwmi_layer *layer = wl_container_of(listener, layer, map);
|
||||||
|
|
||||||
layer->output->damaged = true;
|
layer->output->damaged = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
struct kiwmi_layer *layer = wl_container_of(listener, layer, unmap);
|
||||||
|
|
||||||
layer->output->damaged = true;
|
layer->output->damaged = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -40,7 +40,7 @@ render_layer_surface(struct wlr_surface *surface, int x, int y, void *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!output->damaged) {
|
if (output->damaged == 0) {
|
||||||
wlr_surface_send_frame_done(surface, rdata->when);
|
wlr_surface_send_frame_done(surface, rdata->when);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ render_surface(struct wlr_surface *surface, int sx, int sy, void *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!output->damaged) {
|
if (output->damaged == 0) {
|
||||||
wlr_surface_send_frame_done(surface, rdata->when);
|
wlr_surface_send_frame_done(surface, rdata->when);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ output_frame_notify(struct wl_listener *listener, void *data)
|
||||||
wlr_output_effective_resolution(wlr_output, &width, &height);
|
wlr_output_effective_resolution(wlr_output, &width, &height);
|
||||||
|
|
||||||
wlr_renderer_begin(renderer, width, height);
|
wlr_renderer_begin(renderer, width, height);
|
||||||
if (output->damaged) {
|
if (output->damaged > 0) {
|
||||||
wlr_renderer_clear(renderer, desktop->bg_color);
|
wlr_renderer_clear(renderer, desktop->bg_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ output_frame_notify(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
rdata.data = view;
|
rdata.data = view;
|
||||||
|
|
||||||
if (output->damaged) {
|
if (output->damaged > 0) {
|
||||||
wl_signal_emit(&view->events.pre_render, &rdata);
|
wl_signal_emit(&view->events.pre_render, &rdata);
|
||||||
view_for_each_surface(view, render_surface, &rdata);
|
view_for_each_surface(view, render_surface, &rdata);
|
||||||
wl_signal_emit(&view->events.post_render, &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_output_render_software_cursors(wlr_output, NULL);
|
||||||
wlr_renderer_end(renderer);
|
wlr_renderer_end(renderer);
|
||||||
|
|
||||||
output->damaged = false;
|
--output->damaged;
|
||||||
|
|
||||||
wlr_output_commit(wlr_output);
|
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) {
|
if (event->committed & WLR_OUTPUT_STATE_TRANSFORM) {
|
||||||
arrange_layers(output);
|
arrange_layers(output);
|
||||||
output->damaged = true;
|
output->damaged = 2;
|
||||||
|
|
||||||
wl_signal_emit(&output->events.resize, output);
|
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);
|
struct kiwmi_output *output = wl_container_of(listener, output, mode);
|
||||||
|
|
||||||
arrange_layers(output);
|
arrange_layers(output);
|
||||||
output->damaged = true;
|
output->damaged = 2;
|
||||||
|
|
||||||
wl_signal_emit(&output->events.resize, output);
|
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.width = wlr_output->width;
|
||||||
output->usable_area.height = wlr_output->height;
|
output->usable_area.height = wlr_output->height;
|
||||||
|
|
||||||
output->damaged = true;
|
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);
|
||||||
|
|
|
@ -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 = 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;
|
struct kiwmi_output *output;
|
||||||
wl_list_for_each (output, &view->desktop->outputs, link) {
|
wl_list_for_each (output, &view->desktop->outputs, link) {
|
||||||
output->damaged = true;
|
output->damaged = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,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 = true;
|
output->damaged = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_signal_emit(&view->desktop->events.view_map, view);
|
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;
|
struct kiwmi_output *output;
|
||||||
wl_list_for_each (output, &view->desktop->outputs, link) {
|
wl_list_for_each (output, &view->desktop->outputs, link) {
|
||||||
output->damaged = true;
|
output->damaged = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_signal_emit(&view->events.unmap, view);
|
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)) {
|
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 = true;
|
output->damaged = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ process_cursor_motion(struct kiwmi_server *server, uint32_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_for_each (output, &server->desktop.outputs, link) {
|
wl_list_for_each (output, &server->desktop.outputs, link) {
|
||||||
output->damaged = true;
|
output->damaged = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 = true;
|
output->damaged = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_cursor_set_surface(
|
wlr_cursor_set_surface(
|
||||||
|
|
Loading…
Reference in a new issue