diff --git a/maomao.c b/maomao.c index df2abcd..568433e 100644 --- a/maomao.c +++ b/maomao.c @@ -227,7 +227,7 @@ typedef struct { bool is_open_animation; bool is_restoring_from_ov; float scroller_proportion; - + bool need_set_position; struct dwl_animation animation; } Client; @@ -874,20 +874,23 @@ void client_apply_clip(Client *c) { bool client_draw_frame(Client *c) { if (!c || !client_surface(c)->mapped) return false; - // if (!VISIBLEON(c, c->mon)) - // return false; + + if (!c->need_set_position) + return false; + bool need_more_frames = false; if (c->animation.running) { if (client_animation_next_tick(c)) { need_more_frames = true; } + client_apply_clip(c); } else { wlr_scene_node_set_position(&c->scene->node, c->pending.x, c->pending.y); apply_border(c, c->pending, 0); + client_apply_clip(c); + c->need_set_position = false; } - client_apply_clip(c); - return need_more_frames; } @@ -3638,6 +3641,14 @@ rendermon(struct wl_listener *listener, void *data) { struct timespec now; bool need_more_frames = false; + wl_list_for_each(c, &clients, link) { + need_more_frames = client_draw_frame(c); + } + + if (need_more_frames) { + wlr_output_schedule_frame(m->wlr_output); + } + /* Render if no XDG clients have an outstanding resize and are visible on * this monitor. */ wl_list_for_each(c, &clients, link) { @@ -3646,13 +3657,6 @@ rendermon(struct wl_listener *listener, void *data) { goto skip; } - wl_list_for_each(c, &clients, link) { - need_more_frames = client_draw_frame(c); - } - - if (need_more_frames) { - wlr_output_schedule_frame(m->wlr_output); - } /* * HACK: The "correct" way to set the gamma is to commit it together with @@ -3681,12 +3685,12 @@ rendermon(struct wl_listener *listener, void *data) { wlr_scene_output_commit(m->scene_output, NULL); } +skip: + struct wlr_scene_output *scene_output = wlr_scene_get_scene_output(scene, m->wlr_output); wlr_scene_output_commit(scene_output, NULL); -skip: - clock_gettime(CLOCK_MONOTONIC, &now); wlr_scene_output_send_frame_done(scene_output, &now); wlr_output_state_finish(&pending); @@ -3901,6 +3905,8 @@ void resize(Client *c, struct wlr_box geo, int interact) { if (!c->mon) return; + + c->need_set_position = true; // oldgeom = c->geom; bbox = interact ? &sgeom : &c->mon->w;