diff --git a/src/animation/client.h b/src/animation/client.h index 52d6973..e1fc551 100644 --- a/src/animation/client.h +++ b/src/animation/client.h @@ -820,7 +820,7 @@ void init_fadeout_client(Client *c) { fadeout_cient->animation.passed_frames = 0; fadeout_cient->animation.total_frames = - fadeout_cient->animation.duration / output_frame_duration_ms(); + fadeout_cient->animation.duration / all_output_frame_duration_ms(); wlr_scene_node_set_enabled(&fadeout_cient->scene->node, true); wl_list_insert(&fadeout_clients, &fadeout_cient->fadeout_link); @@ -840,7 +840,7 @@ void client_commit(Client *c) { // 设置动画速度 c->animation.passed_frames = 0; c->animation.total_frames = - c->animation.duration / output_frame_duration_ms(); + c->animation.duration / all_output_frame_duration_ms(); // 标记动画开始 c->animation.running = true; diff --git a/src/animation/common.h b/src/animation/common.h index 02a87f1..cc0f76c 100644 --- a/src/animation/common.h +++ b/src/animation/common.h @@ -76,7 +76,7 @@ double find_animation_curve_at(double t, int type) { return baked_points[up].y; } -double output_frame_duration_ms() { +double all_output_frame_duration_ms() { int32_t refresh_total = 0; Monitor *m; wl_list_for_each(m, &mons, link) { @@ -88,6 +88,10 @@ double output_frame_duration_ms() { return 1000000.0 / refresh_total; } +double output_frame_duration_ms(Monitor *m) { + return 1000000.0 / m->wlr_output->refresh; +} + static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly, struct wlr_scene_tree *snapshot_tree) { if (!node->enabled && node->type != WLR_SCENE_NODE_TREE) { diff --git a/src/animation/layer.h b/src/animation/layer.h index bf40da9..755b3e0 100644 --- a/src/animation/layer.h +++ b/src/animation/layer.h @@ -445,7 +445,7 @@ void init_fadeout_layers(LayerSurface *l) { // 计算动画帧数 fadeout_layer->animation.passed_frames = 0; fadeout_layer->animation.total_frames = - fadeout_layer->animation.duration / output_frame_duration_ms(); + fadeout_layer->animation.duration / all_output_frame_duration_ms(); // 将节点插入到关闭动画链表中,屏幕刷新哪里会检查链表中是否有节点可以应用于动画 wlr_scene_node_set_enabled(&fadeout_layer->scene->node, true); @@ -531,7 +531,7 @@ void layer_commit(LayerSurface *l) { // 设置动画速度 l->animation.passed_frames = 0; l->animation.total_frames = - l->animation.duration / output_frame_duration_ms(); + l->animation.duration / output_frame_duration_ms(l->mon); // 标记动画开始 l->animation.running = true; diff --git a/src/mango.c b/src/mango.c index 8fc321b..2a42398 100644 --- a/src/mango.c +++ b/src/mango.c @@ -684,7 +684,7 @@ static double find_animation_curve_at(double t, int type); static void apply_opacity_to_rect_nodes(Client *c, struct wlr_scene_node *node, double animation_passed); static enum corner_location set_client_corner_location(Client *c); -static double output_frame_duration_ms(); +static double all_output_frame_duration_ms(); static struct wlr_scene_tree * wlr_scene_tree_snapshot(struct wlr_scene_node *node, struct wlr_scene_tree *parent);