mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-29 05:40:21 -04:00
feat: support animaiton type none
This commit is contained in:
parent
9428510615
commit
3795899434
2 changed files with 40 additions and 8 deletions
|
|
@ -510,7 +510,7 @@ void client_apply_clip(Client *c) {
|
|||
|
||||
int bw = (int)c->bw;
|
||||
|
||||
if (!animations) {
|
||||
if (!animations || !c->animation.running) {
|
||||
c->animation.running = false;
|
||||
c->need_output_flush = false;
|
||||
c->animainit_geom = c->current = c->pending = c->animation.current =
|
||||
|
|
@ -734,8 +734,10 @@ void init_fadeout_client(Client *c) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (c->animation_type_close &&
|
||||
strcmp(c->animation_type_close, "none") == 0) {
|
||||
if ((c->animation_type_close &&
|
||||
strcmp(c->animation_type_close, "none") == 0) ||
|
||||
(!c->animation_type_close &&
|
||||
strcmp(animation_type_close, "none") == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -822,6 +824,12 @@ void client_commit(Client *c) {
|
|||
// 标记动画开始
|
||||
c->animation.running = true;
|
||||
c->animation.should_animate = false;
|
||||
} else {
|
||||
// 如果动画没有开始,且被判定为不应该动画,
|
||||
// 则设置总帧数为1,不然其他地方一旦获取动画
|
||||
// 进度,总帧数作为分母会造成除零
|
||||
if (!c->animation.running)
|
||||
c->animation.total_frames = 1;
|
||||
}
|
||||
// 请求刷新屏幕
|
||||
wlr_output_schedule_frame(c->mon->wlr_output);
|
||||
|
|
@ -842,6 +850,14 @@ void client_set_pending_state(Client *c) {
|
|||
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);
|
||||
c->dirty = true;
|
||||
|
|
@ -953,11 +969,6 @@ void resize(Client *c, struct wlr_box geo, int interact) {
|
|||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -302,6 +302,13 @@ void init_fadeout_layers(LayerSurface *l) {
|
|||
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 ||
|
||||
l->layer_surface->current.layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND)
|
||||
return;
|
||||
|
|
@ -388,6 +395,14 @@ void layer_set_pending_state(LayerSurface *l) {
|
|||
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.action = OPEN;
|
||||
// 开始动画
|
||||
|
|
@ -416,6 +431,12 @@ void layer_commit(LayerSurface *l) {
|
|||
// 标记动画开始
|
||||
l->animation.running = true;
|
||||
l->animation.should_animate = false;
|
||||
} else {
|
||||
// 如果动画没有开始,且被判定为不应该动画,
|
||||
// 则设置总帧数为1,不然其他地方一旦获取动画
|
||||
// 进度,总帧数作为分母会造成除零
|
||||
if (!l->animation.running)
|
||||
l->animation.total_frames = 1;
|
||||
}
|
||||
// 请求刷新屏幕
|
||||
wlr_output_schedule_frame(l->mon->wlr_output);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue