Skip to content

Commit 13d0afb

Browse files
committed
fix: improve resize edge stability
1 parent 3f2290c commit 13d0afb

2 files changed

Lines changed: 12 additions & 18 deletions

File tree

TODO.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
- Per-window animation overrides
33
- Ensure animations and blur work together without visual artifacts
44
- Custom animation shaders for windows (e.g. open/close animations)
5-
- Tiled and interactive resize does not have stable position (edge(s) that should not move do(es) not have stable position), specifically for undersized surfaces (surfaces that are smaller than their allocated size)
65
- Floating toplevels do not animate their position on workspace switch
76

87
# Effects

src/animation.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -694,27 +694,22 @@ static void update_resize_entry(animation_entry_t *entry) {
694694
if (IS_TILED(c) || c->state == STATE_FLOATING || c->state == STATE_FULLSCREEN) {
695695
int geo_w = (int)entry->toplevel->geometry.width;
696696
int geo_h = (int)entry->toplevel->geometry.height;
697-
bool undersized = geo_w < entry->to.width || geo_h < entry->to.height;
698697

698+
// always honour anchored edges, even for undersized surfaces
699699
int cx, cy;
700-
if (undersized) {
700+
if (entry->from.x == entry->to.x)
701+
cx = 0;
702+
else if (from_right == to_right)
703+
cx = width - geo_w;
704+
else
701705
cx = (width - geo_w) / 2;
706+
707+
if (entry->from.y == entry->to.y)
708+
cy = 0;
709+
else if (from_bottom == to_bottom)
710+
cy = height - geo_h;
711+
else
702712
cy = (height - geo_h) / 2;
703-
} else {
704-
if (entry->from.x == entry->to.x)
705-
cx = 0;
706-
else if (from_right == to_right)
707-
cx = width - geo_w;
708-
else
709-
cx = (width - geo_w) / 2;
710-
711-
if (entry->from.y == entry->to.y)
712-
cy = 0;
713-
else if (from_bottom == to_bottom)
714-
cy = height - geo_h;
715-
else
716-
cy = (height - geo_h) / 2;
717-
}
718713

719714
if (cx < 0)
720715
cx = 0;

0 commit comments

Comments
 (0)