support fadein fadeout animation

This commit is contained in:
DreamMaoMao 2025-02-06 10:48:45 +08:00
parent 00d42f5d4f
commit 9b809f4011

23
main.c
View file

@ -129,6 +129,7 @@ struct dwl_animation {
bool tagining; bool tagining;
bool tagouted; bool tagouted;
bool tagouting; bool tagouting;
bool begin_fade_in;
uint32_t total_frames; uint32_t total_frames;
uint32_t passed_frames; uint32_t passed_frames;
struct wlr_box initial; struct wlr_box initial;
@ -686,12 +687,23 @@ client_animation_next_tick(Client *c)
.height = height, .height = height,
}; };
if(c->is_open_animation && animation_fade_in) if(!c->iskilling && (c->is_open_animation||c->animation.begin_fade_in) && animation_fade_in) {
c->animation.begin_fade_in = true;
client_set_opacity(c,animation_passed); client_set_opacity(c,animation_passed);
}
if(c->iskilling) {
client_set_opacity(c,1 - animation_passed );
}
c->is_open_animation = false;
if (animation_passed == 1.0) if (animation_passed == 1.0)
{ {
c->is_open_animation = false; if(c->animation.begin_fade_in) {
c->animation.begin_fade_in = false;
}
c->animation.running = false; c->animation.running = false;
if(c->iskilling) { if(c->iskilling) {
c->iskilling = false; c->iskilling = false;
@ -2616,7 +2628,7 @@ focustop(Monitor *m)
{ {
Client *c; Client *c;
wl_list_for_each(c, &fstack, flink) { wl_list_for_each(c, &fstack, flink) {
if(c->iskilling || c->animation.tagouting || c->animation.tagouted) if(c->iskilling)
continue; continue;
if (VISIBLEON(c, m)) if (VISIBLEON(c, m))
return c; return c;
@ -3786,6 +3798,11 @@ resize(Client *c, struct wlr_box geo, int interact)
c->geom = geo; c->geom = geo;
applybounds(c, bbox);//去掉这个推荐的窗口大小,因为有时推荐的窗口特别大导致平铺异常 applybounds(c, bbox);//去掉这个推荐的窗口大小,因为有时推荐的窗口特别大导致平铺异常
if(!c->is_open_animation) {
c->animation.begin_fade_in = false;
client_set_opacity(c,1);
}
// 动画起始位置大小设置 // 动画起始位置大小设置
if(c->animation.tagouting) { if(c->animation.tagouting) {
c->animainit_geom = c->geom; c->animainit_geom = c->geom;