mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-10 13:29:55 -05:00
feat: support animaiton type none
This commit is contained in:
parent
a42d794b5e
commit
0fbb788e45
2 changed files with 40 additions and 8 deletions
|
|
@ -383,7 +383,7 @@ void client_apply_clip(Client *c) {
|
||||||
|
|
||||||
int bw = (int)c->bw;
|
int bw = (int)c->bw;
|
||||||
|
|
||||||
if (!animations) {
|
if (!animations || !c->animation.running) {
|
||||||
c->animation.running = false;
|
c->animation.running = false;
|
||||||
c->need_output_flush = false;
|
c->need_output_flush = false;
|
||||||
c->animainit_geom = c->current = c->pending = c->animation.current =
|
c->animainit_geom = c->current = c->pending = c->animation.current =
|
||||||
|
|
@ -604,8 +604,10 @@ void init_fadeout_client(Client *c) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->animation_type_close &&
|
if ((c->animation_type_close &&
|
||||||
strcmp(c->animation_type_close, "none") == 0) {
|
strcmp(c->animation_type_close, "none") == 0) ||
|
||||||
|
(!c->animation_type_close &&
|
||||||
|
strcmp(animation_type_close, "none") == 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -692,6 +694,12 @@ void client_commit(Client *c) {
|
||||||
// 标记动画开始
|
// 标记动画开始
|
||||||
c->animation.running = true;
|
c->animation.running = true;
|
||||||
c->animation.should_animate = false;
|
c->animation.should_animate = false;
|
||||||
|
} else {
|
||||||
|
// 如果动画没有开始,且被判定为不应该动画,
|
||||||
|
// 则设置总帧数为1,不然其他地方一旦获取动画
|
||||||
|
// 进度,总帧数作为分母会造成除零
|
||||||
|
if (!c->animation.running)
|
||||||
|
c->animation.total_frames = 1;
|
||||||
}
|
}
|
||||||
// 请求刷新屏幕
|
// 请求刷新屏幕
|
||||||
wlr_output_schedule_frame(c->mon->wlr_output);
|
wlr_output_schedule_frame(c->mon->wlr_output);
|
||||||
|
|
@ -712,6 +720,14 @@ void client_set_pending_state(Client *c) {
|
||||||
c->animation.should_animate = true;
|
c->animation.should_animate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (((c->animation_type_open &&
|
||||||
|
strcmp(c->animation_type_open, "none") == 0) ||
|
||||||
|
(!c->animation_type_open &&
|
||||||
|
strcmp(animation_type_open, "none") == 0)) &&
|
||||||
|
c->animation.action == OPEN) {
|
||||||
|
c->animation.should_animate = false;
|
||||||
|
}
|
||||||
|
|
||||||
// 开始动画
|
// 开始动画
|
||||||
client_commit(c);
|
client_commit(c);
|
||||||
c->dirty = true;
|
c->dirty = true;
|
||||||
|
|
@ -822,11 +838,6 @@ void resize(Client *c, struct wlr_box geo, int interact) {
|
||||||
c->animainit_geom = c->geom;
|
c->animainit_geom = c->geom;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->animation_type_open && strcmp(c->animation_type_open, "none") == 0 &&
|
|
||||||
c->animation.action == OPEN) {
|
|
||||||
c->animainit_geom = c->geom;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 开始应用动画设置
|
// 开始应用动画设置
|
||||||
client_set_pending_state(c);
|
client_set_pending_state(c);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -253,6 +253,13 @@ void init_fadeout_layers(LayerSurface *l) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((l->animation_type_close &&
|
||||||
|
strcmp(l->animation_type_close, "none") == 0) ||
|
||||||
|
(!l->animation_type_close &&
|
||||||
|
strcmp(layer_animation_type_close, "none") == 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (l->layer_surface->current.layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM ||
|
if (l->layer_surface->current.layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM ||
|
||||||
l->layer_surface->current.layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND)
|
l->layer_surface->current.layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND)
|
||||||
return;
|
return;
|
||||||
|
|
@ -339,6 +346,14 @@ void layer_set_pending_state(LayerSurface *l) {
|
||||||
l->animation.should_animate = true;
|
l->animation.should_animate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (((l->animation_type_open &&
|
||||||
|
strcmp(l->animation_type_open, "none") == 0) ||
|
||||||
|
(!l->animation_type_open &&
|
||||||
|
strcmp(layer_animation_type_open, "none") == 0)) &&
|
||||||
|
l->animation.action == OPEN) {
|
||||||
|
l->animation.should_animate = false;
|
||||||
|
}
|
||||||
|
|
||||||
l->animation.duration = animation_duration_open;
|
l->animation.duration = animation_duration_open;
|
||||||
l->animation.action = OPEN;
|
l->animation.action = OPEN;
|
||||||
// 开始动画
|
// 开始动画
|
||||||
|
|
@ -367,6 +382,12 @@ void layer_commit(LayerSurface *l) {
|
||||||
// 标记动画开始
|
// 标记动画开始
|
||||||
l->animation.running = true;
|
l->animation.running = true;
|
||||||
l->animation.should_animate = false;
|
l->animation.should_animate = false;
|
||||||
|
} else {
|
||||||
|
// 如果动画没有开始,且被判定为不应该动画,
|
||||||
|
// 则设置总帧数为1,不然其他地方一旦获取动画
|
||||||
|
// 进度,总帧数作为分母会造成除零
|
||||||
|
if (!l->animation.running)
|
||||||
|
l->animation.total_frames = 1;
|
||||||
}
|
}
|
||||||
// 请求刷新屏幕
|
// 请求刷新屏幕
|
||||||
wlr_output_schedule_frame(l->mon->wlr_output);
|
wlr_output_schedule_frame(l->mon->wlr_output);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue