Skip to content

Commit

Permalink
win: keep track of per-window damage
Browse files Browse the repository at this point in the history
This is not used anywhere yet, but is intended for damage calculation
refactor.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
  • Loading branch information
yshui committed Apr 2, 2024
1 parent 3cd107a commit 9210536
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,11 +704,17 @@ static inline void repair_win(session_t *ps, struct managed_win *w) {
}

// Remove the part in the damage area that could be ignored
region_t without_ignored;
pixman_region32_init(&without_ignored);
if (w->reg_ignore && win_is_region_ignore_valid(ps, w)) {
pixman_region32_subtract(&parts, &parts, w->reg_ignore);
pixman_region32_subtract(&without_ignored, &parts, w->reg_ignore);
}

add_damage(ps, &parts);
add_damage(ps, &without_ignored);
pixman_region32_fini(&without_ignored);

pixman_region32_translate(&parts, -w->g.x, -w->g.y);
pixman_region32_copy(&w->damaged, &parts);
pixman_region32_fini(&parts);
}

Expand Down
2 changes: 2 additions & 0 deletions src/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,7 @@ struct win *attr_ret_nonnull maybe_allocate_managed_win(session_t *ps, struct wi
};
win_set_properties_stale(new, init_stale_props, ARR_SIZE(init_stale_props));
c2_window_state_init(ps->c2_state, &new->c2_state);
pixman_region32_init(&new->damaged);

return &new->base;
}
Expand Down Expand Up @@ -2179,6 +2180,7 @@ void destroy_win_finish(session_t *ps, struct win *w) {
w2->prev_trans = NULL;
}
}
pixman_region32_fini(&mw->damaged);
}

free(w);
Expand Down
3 changes: 3 additions & 0 deletions src/win.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ struct managed_win {
/// Background texture of the window
glx_texture_t *glx_texture_bg;
#endif

/// The damaged region of the window, in window local coordinates.
region_t damaged;
};

/// Process pending updates/images flags on a window. Has to be called in X critical
Expand Down

0 comments on commit 9210536

Please sign in to comment.