Skip to content

Commit

Permalink
wm/win: remove useless check and an unused function
Browse files Browse the repository at this point in the history
In return, we don't need the padding check on window_options any more.

Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Oct 15, 2024
1 parent f326ad6 commit 87b9f6c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
- `sw-opti`
- `clear-shadow`

# 12.x (unreleased)

## Build fixes

* Fix build on arm32

# 12.3 (2024-Oct-14)

## Improvements
Expand Down
11 changes: 0 additions & 11 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ struct window_maybe_options {
struct win_script animations[ANIMATION_TRIGGER_COUNT];
};

// Make sure `window_options` has no implicit padding.
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wpadded"
/// Like `window_maybe_options`, but all fields are guaranteed to be set.
struct window_options {
double opacity;
Expand All @@ -220,14 +217,6 @@ struct window_options {

struct win_script animations[ANIMATION_TRIGGER_COUNT];
};
#pragma GCC diagnostic pop

static inline bool
win_options_no_damage(const struct window_options *a, const struct window_options *b) {
// Animation changing does not immediately change how window is rendered, so
// they don't cause damage.
return memcmp(a, b, offsetof(struct window_options, animations)) == 0;
}

/// Structure representing all options.
typedef struct options {
Expand Down
13 changes: 2 additions & 11 deletions src/wm/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,13 +450,9 @@ void win_process_secondary_flags(session_t *ps, struct win *w) {
return;
}

// Save the old window options, so if shadow changes from true to false,
// we can release the shadow.
auto old_options = win_options(w);
region_t extents;
pixman_region32_init(&extents);
// Save old window extents. If window goes from having a shadow to not
// having a shadow, we need to add the old, having-shadow extents to
// damage.
win_extents(w, &extents);

// Factor change flags could be set by previous stages, so must be handled
// last
Expand All @@ -466,15 +462,10 @@ void win_process_secondary_flags(session_t *ps, struct win *w) {
}

auto new_options = win_options(w);
if (win_options_no_damage(&old_options, &new_options)) {
pixman_region32_fini(&extents);
return;
}

if (new_options.shadow != old_options.shadow && !new_options.shadow) {
win_release_shadow(ps->backend_data, w);
}
pixman_region32_fini(&extents);
}

void win_process_image_flags(session_t *ps, struct win *w) {
Expand Down

0 comments on commit 87b9f6c

Please sign in to comment.