Skip to content

Commit 44b4970

Browse files
committed
round_borders_rule bugfix
1 parent 20c6412 commit 44b4970

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

picom.sample.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ round-borders-rule = [
3131
"3:class_g = 'XTerm'",
3232
"3:class_g = 'URxvt'",
3333
"10:class_g = 'Alacritty'",
34-
"15:class_g = 'Signal'",
34+
"15:class_g = 'Signal'"
3535
];
3636

3737
#################################

src/backend/gl/gl_common.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -966,8 +966,8 @@ bool gl_round(backend_t *backend_data attr_unused, struct managed_win *w, void *
966966
auto gd = (struct gl_data *)backend_data;
967967
auto img = (struct gl_image*)image_data;
968968

969-
//log_warn("r(%d) b(%d), wxy(%d %d) wwh(%d %d) img(%d %d)",
970-
// w->corner_radius, w->g.border_width, w->g.x, w->g.y,
969+
//log_warn("r(%d) b(%d) bo(%d), wxy(%d %d) wwh(%d %d) img(%d %d)",
970+
// w->corner_radius, w->g.border_width, w->border_width, w->g.x, w->g.y,
971971
// w->widthb, w->heightb, img->inner->width, img->inner->height);
972972

973973
int nrects;
@@ -1038,7 +1038,7 @@ bool gl_round(backend_t *backend_data attr_unused, struct managed_win *w, void *
10381038
if (ppass->unifm_texsize)
10391039
glUniform2f(ppass->unifm_texsize, (float)w->widthb, (float)w->heightb);
10401040
if (ppass->unifm_borderw)
1041-
glUniform1f(ppass->unifm_borderw, (w->round_borders) ? w->g.border_width : 0);
1041+
glUniform1f(ppass->unifm_borderw, (w->round_borders) ? (w->border_width > 0 ? w->border_width : w->g.border_width) : 0);
10421042
if (ppass->unifm_resolution)
10431043
glUniform2f(ppass->unifm_resolution, (float)gd->width, (float)gd->height);
10441044

src/opengl.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -2342,7 +2342,7 @@ bool glx_round_corners_dst0(session_t *ps, struct managed_win *w, const glx_text
23422342
//log_warn("dxy(%d, %d) wh(%d %d) rwh(%d %d) bw(%d)",
23432343
// dx, dy, width, height, ps->root_width, ps->root_height, w->g.border_width);
23442344

2345-
if (w->g.border_width >= 1 /*&& w->border_col[0] == -1.0*/) {
2345+
if (w->g.border_width >= 1 || w->border_width > 0) {
23462346
glx_read_border_pixel(w, ps->root_height, dx, dy, width, height, w->corner_radius, &w->border_col[0]);
23472347
}
23482348

@@ -2442,7 +2442,7 @@ bool glx_round_corners_dst0(session_t *ps, struct managed_win *w, const glx_text
24422442
if (ppass->unifm_texsize >= 0)
24432443
glUniform2f(ppass->unifm_texsize, (float)mwidth, (float)mheight);
24442444
if (ppass->unifm_borderw >= 0)
2445-
glUniform1f(ppass->unifm_borderw, (w->round_borders && w->border_col[0] != -1.) ? w->g.border_width : 0);
2445+
glUniform1f(ppass->unifm_borderw, (w->round_borders && w->border_col[0] != -1.) ? (w->border_width > 0 ? w->border_width : w->g.border_width) : 0);
24462446
if (ppass->unifm_borderc >= 0)
24472447
glUniform4fv(ppass->unifm_borderc, 1, (GLfloat *)&w->border_col[0]);
24482448
if (ppass->unifm_resolution >= 0)
@@ -2529,7 +2529,7 @@ bool glx_round_corners_dst1(session_t *ps, struct managed_win *w, const glx_text
25292529
assert(ps->psglx->round_passes[1].prog);
25302530
bool ret = false;
25312531

2532-
if (w->g.border_width >= 1 /*&& w->border_col[0] == -1.0*/) {
2532+
if (w->g.border_width >= 1 || w->border_width > 0) {
25332533
glx_read_border_pixel(w, ps->root_height, dx, dy, width, height, w->corner_radius, &w->border_col[0]);
25342534
}
25352535

@@ -2561,7 +2561,7 @@ bool glx_round_corners_dst1(session_t *ps, struct managed_win *w, const glx_text
25612561
if (ppass->unifm_texsize >= 0)
25622562
glUniform2f(ppass->unifm_texsize, (float)width, (float)height);
25632563
if (ppass->unifm_borderw >= 0)
2564-
glUniform1f(ppass->unifm_borderw, (w->round_borders && w->border_col[0] != -1.) ? w->g.border_width : 0);
2564+
glUniform1f(ppass->unifm_borderw, (w->round_borders && w->border_col[0] != -1.) ? (w->border_width > 0 ? w->border_width : w->g.border_width) : 0);
25652565
if (ppass->unifm_borderc >= 0)
25662566
glUniform4fv(ppass->unifm_borderc, 1, (GLfloat *)&w->border_col[0]);
25672567
if (ppass->unifm_resolution >= 0)

src/win.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -936,9 +936,11 @@ static void win_determine_rounded_corners(session_t *ps, struct managed_win *w)
936936
}
937937

938938
void *val = NULL;
939-
if (w && c2_match(ps, w, ps->o.round_borders_rules, &val)) {
940-
w->g.border_width = (uint16_t)((long)val);
939+
if (c2_match(ps, w, ps->o.round_borders_rules, &val)) {
940+
w->border_width = (uint16_t)((long)val);
941941
//log_warn("xy(%d %d) wh(%d %d) border_width:rule:%d", w->g.x, w->g.y, w->widthb, w->heightb, w->g.border_width);
942+
} else {
943+
w->border_width = 0;
942944
}
943945

944946
if (w && c2_match(ps, w, ps->o.round_borders_blacklist, NULL)) {

src/win.h

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ struct managed_win {
206206
int corner_radius;
207207
bool round_borders;
208208
float border_col[4];
209+
uint16_t border_width;
209210

210211
// Fading-related members
211212
/// Override value of window fade state. Set by D-Bus method calls.

0 commit comments

Comments
 (0)