diff --git a/examples/layer-shell.c b/examples/layer-shell.c index 4c501d3d..e559121e 100644 --- a/examples/layer-shell.c +++ b/examples/layer-shell.c @@ -76,7 +76,6 @@ static void draw(void) { int32_t old_top = margin_top; margin_top = -(20 - ((int)frame % 20)); if (old_top != margin_top) { - wlr_log(L_DEBUG, "setting margin to %d", margin_top); zwlr_layer_surface_v1_set_margin(layer_surface, margin_top, 0, 0, 0); wl_surface_commit(wl_surface); diff --git a/include/rootston/output.h b/include/rootston/output.h index 535c07d8..e40ad776 100644 --- a/include/rootston/output.h +++ b/include/rootston/output.h @@ -40,6 +40,8 @@ void output_damage_from_view(struct roots_output *output, void output_damage_whole_drag_icon(struct roots_output *output, struct roots_drag_icon *icon); void output_damage_from_local_surface(struct roots_output *output, - struct wlr_surface *surface, double ox, double oy, float rotation); + struct wlr_surface *surface, double ox, double oy, float rotation); +void output_damage_whole_local_surface(struct roots_output *output, + struct wlr_surface *surface, double ox, double oy, float rotation); #endif diff --git a/rootston/layer_shell.c b/rootston/layer_shell.c index 35896228..5efdf3c9 100644 --- a/rootston/layer_shell.c +++ b/rootston/layer_shell.c @@ -149,8 +149,6 @@ static void arrange_layer(struct wlr_output *output, struct wl_list *list, apply_exclusive(usable_area, state->anchor, state->exclusive_zone, state->margin.top, state->margin.right, state->margin.bottom, state->margin.left); - wlr_log(L_DEBUG, "arranged layer at %dx%d@%d,%d", - box.width, box.height, box.x, box.y); wlr_layer_surface_configure(layer, box.width, box.height); } } @@ -221,11 +219,17 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) { struct wlr_output *wlr_output = layer_surface->output; if (wlr_output != NULL) { struct roots_output *output = wlr_output->data; - output_damage_from_local_surface(output, layer_surface->surface, - layer->geo.x, layer->geo.y, 0); + struct wlr_box old_geo = layer->geo; arrange_layers(wlr_output); - output_damage_from_local_surface(output, layer_surface->surface, - layer->geo.x, layer->geo.y, 0); + if (memcmp(&old_geo, &layer->geo, sizeof(struct wlr_box)) != 0) { + output_damage_whole_local_surface(output, layer_surface->surface, + old_geo.x, old_geo.y, 0); + output_damage_whole_local_surface(output, layer_surface->surface, + layer->geo.x, layer->geo.y, 0); + } else { + output_damage_from_local_surface(output, layer_surface->surface, + layer->geo.x, layer->geo.y, 0); + } } } diff --git a/rootston/output.c b/rootston/output.c index 7c2c6d44..aa74c8d7 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -664,6 +664,14 @@ static void damage_whole_surface(struct wlr_surface *surface, wlr_output_damage_add_box(output->damage, &box); } +void output_damage_whole_local_surface(struct roots_output *output, + struct wlr_surface *surface, double ox, double oy, float rotation) { + struct wlr_output_layout_output *layout = wlr_output_layout_get( + output->desktop->layout, output->wlr_output); + damage_whole_surface(surface, ox + layout->x, oy + layout->y, + rotation, output); +} + static void damage_whole_decoration(struct roots_view *view, struct roots_output *output) { if (!view->decorated || view->wlr_surface == NULL) {