From e2f205c333c0eeadf624ad3d32670975e06581a4 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Mon, 24 Feb 2025 11:00:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8A=A8=E7=94=BB=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E4=B8=A2=E5=A4=B1=E6=9C=80=E5=90=8E=E4=B8=80=E5=B8=A7?= =?UTF-8?q?=E4=B8=8D=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maomao.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/maomao.c b/maomao.c index af5d82f2..a617aa98 100644 --- a/maomao.c +++ b/maomao.c @@ -233,7 +233,7 @@ typedef struct { bool is_open_animation; bool is_restoring_from_ov; float scroller_proportion; - bool need_set_position; + bool need_output_flush; struct dwl_animation animation; // struct wl_event_source *timer_tick; @@ -714,7 +714,7 @@ double find_animation_curve_at(double t) { return baked_points[up].y; } -bool client_animation_next_tick(Client *c) { +void client_animation_next_tick(Client *c) { double animation_passed = (double)c->animation.passed_frames / c->animation.total_frames; double factor = find_animation_curve_at(animation_passed); @@ -773,11 +773,11 @@ bool client_animation_next_tick(Client *c) { if (surface && pointer_c == selmon->sel) { wlr_seat_pointer_notify_enter(seat, surface, sx, sy); } - c->need_set_position = false; - return false; + + // end flush in next frame, not the current frame + c->need_output_flush = false; } else { c->animation.passed_frames++; - return true; } } @@ -897,23 +897,20 @@ bool client_draw_frame(Client *c) { if (!c || !client_surface(c)->mapped) return false; - if (!c->need_set_position) + if (!c->need_output_flush) return false; - bool need_more_frames = false; if (c->animation.running) { - if (client_animation_next_tick(c)) { - need_more_frames = true; - } + client_animation_next_tick(c); 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; + c->need_output_flush = false; } // c->resize = 1; - return need_more_frames; + return true; } void // 0.5 @@ -3937,7 +3934,7 @@ void resize(Client *c, struct wlr_box geo, int interact) { return; // wl_event_source_timer_update(c->timer_tick, 10); - c->need_set_position = true; + c->need_output_flush = true; // oldgeom = c->geom; bbox = interact ? &sgeom : &c->mon->w; @@ -3991,7 +3988,7 @@ void resize(Client *c, struct wlr_box geo, int interact) { if (c == grabc) { c->animation.running = false; - c->need_set_position = false; + c->need_output_flush = false; c->animainit_geom = c->current = c->pending = c->animation.current = c->geom; wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y); apply_border(c,c->geom, 0);