Skip to content

Commit fa0e031

Browse files
committed
fix,feat: keep corner masks updated during animations, tiled resize fixes, multi rule matching
1 parent fdd964b commit fa0e031

4 files changed

Lines changed: 50 additions & 16 deletions

File tree

TODO.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Animations
22
- Per-window animation overrides
3-
- Ensure animations and blur work together without visual artifacts (corner masks missing during animations)
3+
- Ensure animations and blur work together without visual artifacts
44
- Custom animation shaders for windows (e.g. open/close animations)
5-
- Resize animations are imperfect (tiled resize)
5+
- Tiled resize does not have stable position (edge(s) that should not move does not have stable position)
66

77
# Effects
88
- Effects per window state (e.g. unfocused, focused, ...)
@@ -15,7 +15,6 @@
1515
# Misc
1616
- Rework the docs to be easier to use
1717
- Minimum sizes are currently always respected, clipping may be preferred in most cases
18-
- Let more than 1 rule match a given client
1918
- Improve the README (include video, images, better info)
2019

2120
# Potential

src/animation.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,13 @@ bool animation_apply_geometry_from(node_t *node, struct wlr_scene_tree *scene_tr
753753
if (!node || !scene_tree)
754754
return false;
755755

756+
// if the size changes, delegate to the resize animation system
757+
if ((from.width != target.width || from.height != target.height) && node->client &&
758+
node->client->toplevel && from.width > 0 && from.height > 0) {
759+
if (animation_start_resize(node->client->toplevel, from, target))
760+
return true;
761+
}
762+
756763
output_t *output = node->output;
757764
if (!animate || !enable_animations || !output || !output->enabled || !node->client ||
758765
!node->client->shown) {
@@ -970,8 +977,16 @@ bool animation_update_output(output_t *output, struct timespec now) {
970977
int y = (int)(entry->from.y + (entry->to.y - entry->from.y) * entry->eased);
971978
wlr_scene_node_set_position(&entry->scene_tree->node, x, y);
972979

973-
if (entry->workspace_switch)
980+
if (entry->workspace_switch) {
974981
update_blur_for_slide_animation(output, entry);
982+
if (entry->node && entry->node->client && entry->node->client->toplevel) {
983+
toplevel_t *tl = entry->node->client->toplevel;
984+
if (tl->rounded && tl->rounded->corner_mask_node) {
985+
tl->rounded->corner_mask_dirty = true;
986+
tl->rounded->border_dirty = true;
987+
}
988+
}
989+
}
975990

976991
if (is_entry_done(entry)) {
977992
if (entry->from_opacity != entry->to_opacity) {

src/effects.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,9 @@ static struct wlr_box get_animated_client_rect(toplevel_t *tl) {
12211221
r.width = 1;
12221222
if (r.height < 1)
12231223
r.height = 1;
1224+
} else if (tl->node && tl->node->output && animation_workspace_switch_active(tl->node->output)) {
1225+
r.x = tl->scene_tree->node.x;
1226+
r.y = tl->scene_tree->node.y;
12241227
}
12251228
return r;
12261229
}

src/rule.c

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -206,28 +206,45 @@ static bool match_string(const char *pattern, const char *value) {
206206
}
207207

208208
rule_consequence_t *find_matching_rule(const char *app_id, const char *title, const char *tag) {
209-
rule_t *r = rule_head;
210-
rule_t *matched = NULL;
209+
static rule_consequence_t merged;
210+
memset(&merged, 0, sizeof(merged));
211211

212+
rule_t *r = rule_head;
212213
while (r != NULL) {
214+
rule_t *next = r->next;
215+
213216
bool app_id_matches = match_string(r->match.app_id, app_id);
214217
bool title_matches = match_string(r->match.title, title);
215218
bool tag_matches = match_string(r->match.tag, tag);
216219

217220
if (app_id_matches && title_matches && tag_matches) {
218-
matched = r;
219-
break;
221+
rule_type_t bits = r->consequence.has;
222+
merged.has |= bits;
223+
merged.flags = (merged.flags & ~bits) | (r->consequence.flags & bits);
224+
225+
if (bits & RULE_TYPE_DESKTOP)
226+
strncpy(merged.desktop, r->consequence.desktop, SMALEN);
227+
if (bits & RULE_TYPE_MONITOR)
228+
strncpy(merged.monitor, r->consequence.monitor, SMALEN);
229+
if (bits & RULE_TYPE_STATE)
230+
merged.state = r->consequence.state;
231+
if (bits & RULE_TYPE_SCROLLER_PROPORTION)
232+
merged.scroller_proportion = r->consequence.scroller_proportion;
233+
if (bits & RULE_TYPE_SCROLLER_PROPORTION_SINGLE)
234+
merged.scroller_proportion_single = r->consequence.scroller_proportion_single;
235+
if (bits & RULE_TYPE_BORDER_RADIUS)
236+
merged.border_radius = r->consequence.border_radius;
237+
if (bits & RULE_TYPE_OPACITY)
238+
merged.opacity = r->consequence.opacity;
239+
240+
if (r->match.one_shot)
241+
remove_rule(r);
220242
}
221-
r = r->next;
222-
}
223-
224-
if (matched == NULL)
225-
return NULL;
226243

227-
if (matched->match.one_shot)
228-
remove_rule(matched);
244+
r = next;
245+
}
229246

230-
return &matched->consequence;
247+
return merged.has ? &merged : NULL;
231248
}
232249

233250
void rule_apply_consequence(node_t *node, client_t *client, const rule_consequence_t *rule) {

0 commit comments

Comments
 (0)