opt: Reduce unnecessary text drawing

This commit is contained in:
DreamMaoMao 2026-06-17 08:35:44 +08:00
parent 49a978382f
commit de22ff2e51
10 changed files with 302 additions and 188 deletions

View file

@ -898,7 +898,7 @@ void fadeout_client_animation_next_tick(Client *c) {
double percent = config.fadeout_begin_opacity -
(opacity_eased_progress * config.fadeout_begin_opacity);
double opacity = MAX(percent, 0);
double opacity = MANGO_MAX(percent, 0);
if (config.animation_fade_out && !c->nofadeout)
wlr_scene_node_for_each_buffer(&c->scene->node,
@ -1177,8 +1177,8 @@ void resize(Client *c, struct wlr_box geo, int32_t interact) {
if (is_scroller_layout(c->mon) && (!c->isfloating || c == grabc)) {
c->geom = geo;
c->geom.width = MAX(1 + 2 * (int32_t)c->bw, c->geom.width);
c->geom.height = MAX(1 + 2 * (int32_t)c->bw, c->geom.height);
c->geom.width = MANGO_MAX(1 + 2 * (int32_t)c->bw, c->geom.width);
c->geom.height = MANGO_MAX(1 + 2 * (int32_t)c->bw, c->geom.height);
} else { // 这里会限制不允许窗口划出屏幕
c->geom = geo;
applybounds(

View file

@ -233,7 +233,7 @@ void fadeout_layer_animation_next_tick(LayerSurface *l) {
double percent = config.fadeout_begin_opacity -
(opacity_eased_progress * config.fadeout_begin_opacity);
double opacity = MAX(percent, 0.0f);
double opacity = MANGO_MAX(percent, 0.0f);
if (config.animation_fade_out)
wlr_scene_node_for_each_buffer(&l->scene->node,
@ -277,10 +277,10 @@ void layer_animation_next_tick(LayerSurface *l) {
double opacity_eased_progress =
find_animation_curve_at(animation_passed, OPAFADEIN);
double opacity =
MIN(config.fadein_begin_opacity +
opacity_eased_progress * (1.0 - config.fadein_begin_opacity),
1.0f);
double opacity = MANGO_MIN(config.fadein_begin_opacity +
opacity_eased_progress *
(1.0 - config.fadein_begin_opacity),
1.0f);
if (config.animation_fade_in)
wlr_scene_node_for_each_buffer(&l->scene->node,

View file

@ -23,23 +23,23 @@ void set_tagin_animation(Monitor *m, Client *c) {
c->animainit_geom.x = config.tag_animation_direction == VERTICAL
? c->animation.current.x
: MAX(c->mon->m.x + c->mon->m.width,
c->geom.x + c->mon->m.width);
: MANGO_MAX(c->mon->m.x + c->mon->m.width,
c->geom.x + c->mon->m.width);
c->animainit_geom.y = config.tag_animation_direction == VERTICAL
? MAX(c->mon->m.y + c->mon->m.height,
c->geom.y + c->mon->m.height)
? MANGO_MAX(c->mon->m.y + c->mon->m.height,
c->geom.y + c->mon->m.height)
: c->animation.current.y;
} else {
c->animainit_geom.x =
config.tag_animation_direction == VERTICAL
? c->animation.current.x
: MIN(m->m.x - c->geom.width, c->geom.x - c->mon->m.width);
c->animainit_geom.y =
config.tag_animation_direction == VERTICAL
? MIN(m->m.y - c->geom.height, c->geom.y - c->mon->m.height)
: c->animation.current.y;
c->animainit_geom.x = config.tag_animation_direction == VERTICAL
? c->animation.current.x
: MANGO_MIN(m->m.x - c->geom.width,
c->geom.x - c->mon->m.width);
c->animainit_geom.y = config.tag_animation_direction == VERTICAL
? MANGO_MIN(m->m.y - c->geom.height,
c->geom.y - c->mon->m.height)
: c->animation.current.y;
}
}
@ -84,13 +84,13 @@ void set_tagout_animation(Monitor *m, Client *c) {
: m->pertag->curtag > m->pertag->prevtag;
if (going_forward) {
c->pending = c->geom;
c->pending.x =
config.tag_animation_direction == VERTICAL
? c->animation.current.x
: MIN(c->mon->m.x - c->geom.width, c->geom.x - c->mon->m.width);
c->pending.x = config.tag_animation_direction == VERTICAL
? c->animation.current.x
: MANGO_MIN(c->mon->m.x - c->geom.width,
c->geom.x - c->mon->m.width);
c->pending.y = config.tag_animation_direction == VERTICAL
? MIN(c->mon->m.y - c->geom.height,
c->geom.y - c->mon->m.height)
? MANGO_MIN(c->mon->m.y - c->geom.height,
c->geom.y - c->mon->m.height)
: c->animation.current.y;
resize(c, c->geom, 0);
@ -98,11 +98,11 @@ void set_tagout_animation(Monitor *m, Client *c) {
c->pending = c->geom;
c->pending.x = config.tag_animation_direction == VERTICAL
? c->animation.current.x
: MAX(c->mon->m.x + c->mon->m.width,
c->geom.x + c->mon->m.width);
: MANGO_MAX(c->mon->m.x + c->mon->m.width,
c->geom.x + c->mon->m.width);
c->pending.y = config.tag_animation_direction == VERTICAL
? MAX(c->mon->m.y + c->mon->m.height,
c->geom.y + c->mon->m.height)
? MANGO_MAX(c->mon->m.y + c->mon->m.height,
c->geom.y + c->mon->m.height)
: c->animation.current.y;
resize(c, c->geom, 0);
}