Fix surface layer damage tracking

master
Drew DeVault 7 years ago
parent e841e5602b
commit 776b81d499

@ -76,7 +76,6 @@ static void draw(void) {
int32_t old_top = margin_top; int32_t old_top = margin_top;
margin_top = -(20 - ((int)frame % 20)); margin_top = -(20 - ((int)frame % 20));
if (old_top != margin_top) { if (old_top != margin_top) {
wlr_log(L_DEBUG, "setting margin to %d", margin_top);
zwlr_layer_surface_v1_set_margin(layer_surface, zwlr_layer_surface_v1_set_margin(layer_surface,
margin_top, 0, 0, 0); margin_top, 0, 0, 0);
wl_surface_commit(wl_surface); wl_surface_commit(wl_surface);

@ -41,5 +41,7 @@ void output_damage_whole_drag_icon(struct roots_output *output,
struct roots_drag_icon *icon); struct roots_drag_icon *icon);
void output_damage_from_local_surface(struct roots_output *output, 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 #endif

@ -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, apply_exclusive(usable_area, state->anchor, state->exclusive_zone,
state->margin.top, state->margin.right, state->margin.top, state->margin.right,
state->margin.bottom, state->margin.left); 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); 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; struct wlr_output *wlr_output = layer_surface->output;
if (wlr_output != NULL) { if (wlr_output != NULL) {
struct roots_output *output = wlr_output->data; struct roots_output *output = wlr_output->data;
output_damage_from_local_surface(output, layer_surface->surface, struct wlr_box old_geo = layer->geo;
layer->geo.x, layer->geo.y, 0);
arrange_layers(wlr_output); 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, output_damage_from_local_surface(output, layer_surface->surface,
layer->geo.x, layer->geo.y, 0); layer->geo.x, layer->geo.y, 0);
} }
}
} }
static void unmap(struct wlr_layer_surface *layer_surface) { static void unmap(struct wlr_layer_surface *layer_surface) {

@ -664,6 +664,14 @@ static void damage_whole_surface(struct wlr_surface *surface,
wlr_output_damage_add_box(output->damage, &box); 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, static void damage_whole_decoration(struct roots_view *view,
struct roots_output *output) { struct roots_output *output) {
if (!view->decorated || view->wlr_surface == NULL) { if (!view->decorated || view->wlr_surface == NULL) {

Loading…
Cancel
Save