fix: opacity winrule not apply

This commit is contained in:
DreamMaoMao 2025-06-14 11:20:27 +08:00
parent a59b1040e4
commit e0b8608cf0
2 changed files with 42 additions and 37 deletions

View file

@ -1348,6 +1348,10 @@ void parse_config_line(Config *config, const char *line) {
rule->isunglobal = atoi(val); rule->isunglobal = atoi(val);
} else if (strcmp(key, "isglobal") == 0) { } else if (strcmp(key, "isglobal") == 0) {
rule->isglobal = atoi(val); rule->isglobal = atoi(val);
} else if (strcmp(key, "unfocused_opacity") == 0) {
rule->unfocused_opacity = atof(val);
} else if (strcmp(key, "focused_opacity") == 0) {
rule->focused_opacity = atof(val);
} else if (strcmp(key, "isoverlay") == 0) { } else if (strcmp(key, "isoverlay") == 0) {
rule->isoverlay = atoi(val); rule->isoverlay = atoi(val);
} else if (strcmp(key, "isterm") == 0) { } else if (strcmp(key, "isterm") == 0) {

View file

@ -1436,11 +1436,11 @@ bool client_draw_frame(Client *c) {
if (!c || !client_surface(c)->mapped) if (!c || !client_surface(c)->mapped)
return false; return false;
if(c->isfullscreen) { if (c->isfullscreen) {
client_set_opacity(c, 1); client_set_opacity(c, 1);
} else if(c == selmon->sel && !c->animation.running) { } else if (c == selmon->sel && !c->animation.running) {
client_set_opacity(c, c->focused_opacity); client_set_opacity(c, c->focused_opacity);
} else if(!c->animation.running) { } else if (!c->animation.running) {
client_set_opacity(c, c->unfocused_opacity); client_set_opacity(c, c->unfocused_opacity);
} }
@ -1451,7 +1451,8 @@ bool client_draw_frame(Client *c) {
client_animation_next_tick(c); client_animation_next_tick(c);
client_apply_clip(c); client_apply_clip(c);
} else { } else {
wlr_scene_node_set_position(&c->scene->node, c->pending.x, c->pending.y); wlr_scene_node_set_position(&c->scene->node, c->pending.x,
c->pending.y);
c->animainit_geom = c->animation.initial = c->pending = c->current = c->animainit_geom = c->animation.initial = c->pending = c->current =
c->geom; c->geom;
client_apply_clip(c); client_apply_clip(c);
@ -2029,9 +2030,9 @@ applyrules(Client *c) {
c->isglobal = r->isglobal >= 0 ? r->isglobal : c->isglobal; c->isglobal = r->isglobal >= 0 ? r->isglobal : c->isglobal;
c->isoverlay = r->isoverlay >= 0 ? r->isoverlay : c->isoverlay; c->isoverlay = r->isoverlay >= 0 ? r->isoverlay : c->isoverlay;
c->isunglobal = r->isunglobal >= 0 ? r->isunglobal : c->isunglobal; c->isunglobal = r->isunglobal >= 0 ? r->isunglobal : c->isunglobal;
c->focused_opacity = r->focused_opacity > 0 ? r->focused_opacity c->focused_opacity = r->focused_opacity > 0.0f ? r->focused_opacity
: c->focused_opacity; : c->focused_opacity;
c->unfocused_opacity = r->unfocused_opacity > 0 c->unfocused_opacity = r->unfocused_opacity > 0.0f
? r->unfocused_opacity ? r->unfocused_opacity
: c->unfocused_opacity; : c->unfocused_opacity;