Fix surface layer damage tracking

This commit is contained in:
Drew DeVault 2018-03-26 23:13:09 -04:00
parent e841e5602b
commit 776b81d499
4 changed files with 21 additions and 8 deletions

View File

@ -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);

View File

@ -41,5 +41,7 @@ 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);
void output_damage_whole_local_surface(struct roots_output *output,
struct wlr_surface *surface, double ox, double oy, float rotation);
#endif

View File

@ -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,12 +219,18 @@ 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);
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);
}
}
}
static void unmap(struct wlr_layer_surface *layer_surface) {

View File

@ -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) {