opt: optimize tagin tagout animaiton

This commit is contained in:
DreamMaoMao 2025-09-10 12:59:58 +08:00
parent 1e9a6cab84
commit 4ae9ff3ac8
2 changed files with 7 additions and 26 deletions

View file

@ -232,8 +232,7 @@ void buffer_set_effect(Client *c, BufferData data) {
if (!c || c->iskilling) if (!c || c->iskilling)
return; return;
if (c->animation.tagouting || c->animation.tagouted || if (c->animation.tagouting || c->animation.tagining) {
c->animation.tagining) {
data.should_scale = false; data.should_scale = false;
} }
@ -442,8 +441,7 @@ struct ivec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
int offsetx = 0, offsety = 0, offsetw = 0, offseth = 0; int offsetx = 0, offsety = 0, offsetw = 0, offseth = 0;
struct ivec2 offset = {0, 0, 0, 0}; struct ivec2 offset = {0, 0, 0, 0};
if (!ISTILED(c) && !c->animation.tagining && !c->animation.tagouted && if (!ISTILED(c) && !c->animation.tagining && !c->animation.tagouting)
!c->animation.tagouting)
return offset; return offset;
int bottom_out_offset = int bottom_out_offset =
@ -463,8 +461,7 @@ struct ivec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
border超出屏幕的时候不计算如偏差之内而是 border超出屏幕的时候不计算如偏差之内而是
*/ */
if (ISTILED(c) || c->animation.tagining || c->animation.tagouted || if (ISTILED(c) || c->animation.tagining || c->animation.tagouting) {
c->animation.tagouting) {
if (left_out_offset > 0) { if (left_out_offset > 0) {
offsetx = GEZERO(left_out_offset - bw); offsetx = GEZERO(left_out_offset - bw);
clip_box->x = clip_box->x + offsetx; clip_box->x = clip_box->x + offsetx;
@ -736,7 +733,6 @@ void client_animation_next_tick(Client *c) {
c->animation.tagouting = false; c->animation.tagouting = false;
wlr_scene_node_set_enabled(&c->scene->node, false); wlr_scene_node_set_enabled(&c->scene->node, false);
client_set_suspended(c, true); client_set_suspended(c, true);
c->animation.tagouted = true;
c->animation.current = c->geom; c->animation.current = c->geom;
} }

View file

@ -217,7 +217,6 @@ struct dwl_animation {
bool should_animate; bool should_animate;
bool running; bool running;
bool tagining; bool tagining;
bool tagouted;
bool tagouting; bool tagouting;
bool begin_fade_in; bool begin_fade_in;
bool tag_from_rule; bool tag_from_rule;
@ -1265,14 +1264,6 @@ void applyrules(Client *c) {
void set_tagin_animation(Monitor *m, Client *c) { void set_tagin_animation(Monitor *m, Client *c) {
c->animation.tagining = true; c->animation.tagining = true;
if (c->animation.running) {
// if animaiton is running,
// use running animation position as init position
c->animainit_geom.x = c->animation.current.x;
c->animainit_geom.y = c->animation.current.y;
return;
}
if (m->pertag->curtag > m->pertag->prevtag) { if (m->pertag->curtag > m->pertag->prevtag) {
// goto next tag animation // goto next tag animation
@ -1323,7 +1314,6 @@ void set_arrange_visible(Monitor *m, Client *c, bool want_animation) {
c->animation.tag_from_rule = false; c->animation.tag_from_rule = false;
c->animation.tagouting = false; c->animation.tagouting = false;
c->animation.tagouted = false;
resize(c, c->geom, 0); resize(c, c->geom, 0);
} }
@ -1361,10 +1351,7 @@ void set_arrange_unvisible(Monitor *m, Client *c, bool want_animation) {
// should apply tag animation // should apply tag animation
set_tagout_animation(m, c); set_tagout_animation(m, c);
} else { } else {
// should not apply tag animation
c->animation.tagouting = false;
c->animation.tagining = false;
c->animation.tagouted = false;
wlr_scene_node_set_enabled(&c->scene->node, false); wlr_scene_node_set_enabled(&c->scene->node, false);
client_set_suspended(c, true); client_set_suspended(c, true);
} }
@ -1400,8 +1387,8 @@ arrange(Monitor *m, bool want_animation) {
} }
} }
if (c->mon == m && c->ismaxmizescreen && !c->animation.tagouted && if (c->mon == m && c->ismaxmizescreen && !c->animation.tagouting &&
!c->animation.tagouting && VISIBLEON(c, m)) { VISIBLEON(c, m)) {
reset_maxmizescreen_size(c); reset_maxmizescreen_size(c);
} }
} }
@ -2320,8 +2307,7 @@ void commitnotify(struct wl_listener *listener, void *data) {
return; return;
} }
if (!c || c->iskilling || c->animation.tagouting || c->animation.tagouted || if (!c || c->iskilling || c->animation.tagouting || c->animation.tagining)
c->animation.tagining)
return; return;
if (c->configure_serial && if (c->configure_serial &&
@ -4964,7 +4950,6 @@ void overview_backup(Client *c) {
c->overview_ismaxmizescreenbak = c->ismaxmizescreen; c->overview_ismaxmizescreenbak = c->ismaxmizescreen;
c->overview_isfullscreenbak = c->isfullscreen; c->overview_isfullscreenbak = c->isfullscreen;
c->animation.tagining = false; c->animation.tagining = false;
c->animation.tagouted = false;
c->animation.tagouting = false; c->animation.tagouting = false;
c->overview_backup_geom = c->geom; c->overview_backup_geom = c->geom;
c->overview_backup_bw = c->bw; c->overview_backup_bw = c->bw;