Skip to content

Commit

Permalink
win: win_update_bounding_shape doesn't need has_shape anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
absolutelynothelix committed May 30, 2024
1 parent 781170f commit f5d0796
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/inspect.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ setup_window(struct x_connection *c, struct atom *atoms, struct options *options
};
free(geometry_reply);

auto shape_info = xcb_get_extension_data(c->c, &xcb_shape_id);
win_on_win_size_change(w, options->shadow_offset_x, options->shadow_offset_y,
options->shadow_radius);
win_update_bounding_shape(c, w, shape_info->present, options->detect_rounded_corners);
win_update_bounding_shape(c, w, options->detect_rounded_corners);
win_update_prop_fullscreen(c, atoms, w);

// Determine if the window is focused
Expand Down Expand Up @@ -187,6 +186,9 @@ int inspect_main(int argc, char **argv, const char *config_file) {
auto state = c2_state_new(atoms);
options_postprocess_c2_lists(state, &c, &options);

auto shape_extension = xcb_get_extension_data(c.c, &xcb_shape_id);
c.e.has_shape = shape_extension && shape_extension->present;

auto target = select_window(&c);
log_info("Target window: %#x", target);
auto w = setup_window(&c, atoms, &options, state, target);
Expand Down
7 changes: 3 additions & 4 deletions src/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,7 @@ void win_process_update_flags(session_t *ps, struct managed_win *w) {
if (win_check_flags_all(w, WIN_FLAGS_SIZE_STALE)) {
win_on_win_size_change(w, ps->o.shadow_offset_x,
ps->o.shadow_offset_y, ps->o.shadow_radius);
win_update_bounding_shape(&ps->c, w, ps->c.e.has_shape,
ps->o.detect_rounded_corners);
win_update_bounding_shape(&ps->c, w, ps->o.detect_rounded_corners);
damaged = true;
win_clear_flags(w, WIN_FLAGS_SIZE_STALE);

Expand Down Expand Up @@ -1900,7 +1899,7 @@ gen_by_val(win_extents);
* Mark the window shape as updated
*/
void win_update_bounding_shape(struct x_connection *c, struct managed_win *w,
bool shape_exists, bool detect_rounded_corners) {
bool detect_rounded_corners) {
// We don't handle property updates of non-visible windows until they are
// mapped.
assert(w->state == WSTATE_MAPPED);
Expand All @@ -1909,7 +1908,7 @@ void win_update_bounding_shape(struct x_connection *c, struct managed_win *w,
// Start with the window rectangular region
win_get_region_local(w, &w->bounding_shape);

if (shape_exists) {
if (c->e.has_shape) {
w->bounding_shaped = win_bounding_shaped(c, w->base.id);
}

Expand Down
2 changes: 1 addition & 1 deletion src/win.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ int win_update_name(struct x_connection *c, struct atom *atoms, struct managed_w
void win_on_win_size_change(struct managed_win *w, int shadow_offset_x,
int shadow_offset_y, int shadow_radius);
void win_update_bounding_shape(struct x_connection *c, struct managed_win *w,
bool shape_exists, bool detect_rounded_corners);
bool detect_rounded_corners);
bool win_update_prop_fullscreen(struct x_connection *c, const struct atom *atoms,
struct managed_win *w);

Expand Down

0 comments on commit f5d0796

Please sign in to comment.