1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-25 14:06:08 -05:00

event, win: delayed handling of shape notify

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-10-23 04:34:05 +01:00
parent f476a78ad1
commit e53ac7a6f9
No known key found for this signature in database
GPG key ID: 37C999F617EA1A47
4 changed files with 20 additions and 17 deletions

View file

@ -653,19 +653,16 @@ static inline void ev_shape_notify(session_t *ps, xcb_shape_notify_event_t *ev)
* seemingly BadRegion errors would be triggered
* if we attempt to rebuild border_size
*/
// Mark the old border_size as damaged
// Mark the old bounding shape as damaged
if (!win_check_flags_any(w, WIN_FLAGS_SIZE_STALE | WIN_FLAGS_POSITION_STALE)) {
region_t tmp = win_get_bounding_shape_global_by_val(w);
add_damage(ps, &tmp);
pixman_region32_fini(&tmp);
win_update_bounding_shape(ps, w);
// Mark the new border_size as damaged
tmp = win_get_bounding_shape_global_by_val(w);
add_damage(ps, &tmp);
pixman_region32_fini(&tmp);
}
w->reg_ignore_valid = false;
win_set_flags(w, WIN_FLAGS_SIZE_STALE);
ps->pending_updates = true;
}
static inline void

View file

@ -255,6 +255,9 @@ gen_by_val(win_get_region_frame_local);
void add_damage_from_win(session_t *ps, const struct managed_win *w) {
// XXX there was a cached extents region, investigate
// if that's better
// TODO(yshui) use the bounding shape when the window is shaped, otherwise the
// damage would be excessive
region_t extents;
pixman_region32_init(&extents);
win_extents(w, &extents);
@ -1681,8 +1684,9 @@ gen_by_val(win_extents);
* Mark the window shape as updated
*/
void win_update_bounding_shape(session_t *ps, struct managed_win *w) {
if (ps->shape_exists)
if (ps->shape_exists) {
w->bounding_shaped = win_bounding_shaped(ps, w->base.id);
}
pixman_region32_clear(&w->bounding_shape);
// Start with the window rectangular region
@ -1700,8 +1704,9 @@ void win_update_bounding_shape(session_t *ps, struct managed_win *w) {
ps->c,
xcb_shape_get_rectangles(ps->c, w->base.id, XCB_SHAPE_SK_BOUNDING), NULL);
if (!r)
if (!r) {
break;
}
xcb_rectangle_t *xrects = xcb_shape_get_rectangles_rectangles(r);
int nrects = xcb_shape_get_rectangles_rectangles_length(r);

View file

@ -434,7 +434,7 @@ void win_set_property_stale(struct managed_win *w, xcb_atom_t prop);
/// Free all resources in a struct win
void free_win_res(session_t *ps, struct managed_win *w);
static inline region_t win_get_bounding_shape_global_by_val(struct managed_win *w) {
static inline region_t attr_unused win_get_bounding_shape_global_by_val(struct managed_win *w) {
region_t ret;
pixman_region32_init(&ret);
pixman_region32_copy(&ret, &w->bounding_shape);
@ -446,7 +446,7 @@ static inline region_t win_get_bounding_shape_global_by_val(struct managed_win *
* Calculate the extents of the frame of the given window based on EWMH
* _NET_FRAME_EXTENTS and the X window border width.
*/
static inline margin_t attr_pure win_calc_frame_extents(const struct managed_win *w) {
static inline margin_t attr_pure attr_unused win_calc_frame_extents(const struct managed_win *w) {
margin_t result = w->frame_extents;
result.top = max2(result.top, w->g.border_width);
result.left = max2(result.left, w->g.border_width);
@ -458,7 +458,7 @@ static inline margin_t attr_pure win_calc_frame_extents(const struct managed_win
/**
* Check whether a window has WM frames.
*/
static inline bool attr_pure win_has_frame(const struct managed_win *w) {
static inline bool attr_pure attr_unused win_has_frame(const struct managed_win *w) {
return w->g.border_width || w->frame_extents.top || w->frame_extents.left ||
w->frame_extents.right || w->frame_extents.bottom;
}

View file

@ -87,6 +87,7 @@ enum win_flags {
WIN_FLAGS_MAPPED = 64,
/// this window has properties which needs to be updated
WIN_FLAGS_PROPERTY_STALE = 128,
// TODO(yshui) _maybe_ split SIZE_STALE into SIZE_STALE and SHAPE_STALE
/// this window has an unhandled size/shape change
WIN_FLAGS_SIZE_STALE = 256,
/// this window has an unhandled position (i.e. x and y) change