diff --git a/src/animation/client.h b/src/animation/client.h index 77aad53..f4c0713 100644 --- a/src/animation/client.h +++ b/src/animation/client.h @@ -694,7 +694,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); @@ -714,7 +714,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 e7d52f3..20cfd86 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 53ccb21..921fac8 100644 --- a/src/animation/layer.h +++ b/src/animation/layer.h @@ -396,7 +396,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); @@ -482,7 +482,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 7d19684..ec76886 100644 --- a/src/mango.c +++ b/src/mango.c @@ -689,7 +689,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 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);