diff --git a/src/animation/client.h b/src/animation/client.h index faef7c2..56ca3d6 100644 --- a/src/animation/client.h +++ b/src/animation/client.h @@ -840,7 +840,8 @@ void init_fadeout_client(Client *c) { wl_list_insert(&fadeout_clients, &fadeout_cient->fadeout_link); // 请求刷新屏幕 - request_fresh_all_monitors(); + if (c->mon) + wlr_output_schedule_frame(c->mon->wlr_output); } void client_commit(Client *c) { @@ -859,7 +860,8 @@ void client_commit(Client *c) { c->animation.should_animate = false; } // 请求刷新屏幕 - request_fresh_all_monitors(); + if (c->mon) + wlr_output_schedule_frame(c->mon->wlr_output); } void client_set_pending_state(Client *c) { diff --git a/src/animation/common.h b/src/animation/common.h index 0f662d6..6e6fa04 100644 --- a/src/animation/common.h +++ b/src/animation/common.h @@ -249,13 +249,3 @@ struct wlr_scene_tree *wlr_scene_tree_snapshot(struct wlr_scene_node *node, return snapshot; } - -void request_fresh_all_monitors(void) { - Monitor *m = NULL; - wl_list_for_each(m, &mons, link) { - if (!m->wlr_output->enabled) { - continue; - } - wlr_output_schedule_frame(m->wlr_output); - } -} \ No newline at end of file diff --git a/src/animation/layer.h b/src/animation/layer.h index 57e0c14..141f132 100644 --- a/src/animation/layer.h +++ b/src/animation/layer.h @@ -467,7 +467,8 @@ void init_fadeout_layers(LayerSurface *l) { wl_list_insert(&fadeout_layers, &fadeout_layer->fadeout_link); // 请求刷新屏幕 - wlr_output_schedule_frame(l->mon->wlr_output); + if (l->mon) + wlr_output_schedule_frame(l->mon->wlr_output); } void layer_set_pending_state(LayerSurface *l) { @@ -550,7 +551,8 @@ void layer_commit(LayerSurface *l) { l->animation.should_animate = false; } // 请求刷新屏幕 - wlr_output_schedule_frame(l->mon->wlr_output); + if (l->mon) + wlr_output_schedule_frame(l->mon->wlr_output); } bool layer_draw_frame(LayerSurface *l) { diff --git a/src/mango.c b/src/mango.c index 54b56cb..6726a6c 100644 --- a/src/mango.c +++ b/src/mango.c @@ -760,7 +760,6 @@ static void resize_tile_client(Client *grabc, bool isdrag, int offsetx, static void refresh_monitors_workspaces_status(Monitor *m); static void init_client_properties(Client *c); static float *get_border_color(Client *c); -static void request_fresh_all_monitors(void); static void clear_fullscreen_and_maximized_state(Monitor *m); #include "data/static_keymap.h" @@ -4294,6 +4293,11 @@ void rendermon(struct wl_listener *listener, void *data) { need_more_frames = layer_draw_fadeout_frame(l) || need_more_frames; } + // 如果需要更多帧,确保安排下一帧 + if (need_more_frames) { + wlr_output_schedule_frame(m->wlr_output); + } + // 绘制客户端 wl_list_for_each(c, &clients, link) { need_more_frames = client_draw_frame(c) || need_more_frames; @@ -4320,11 +4324,6 @@ skip: wlr_scene_output_send_frame_done(m->scene_output, &now); wlr_output_state_finish(&pending); } - - // 如果需要更多帧,确保安排下一帧 - if (need_more_frames) { - request_fresh_all_monitors(); - } } void requestdecorationmode(struct wl_listener *listener, void *data) {