aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--box-drawing.c21
-rw-r--r--config.c9
-rw-r--r--config.h1
-rw-r--r--doc/foot.ini.5.scd10
4 files changed, 31 insertions, 10 deletions
diff --git a/box-drawing.c b/box-drawing.c
index 39deab50..e9e7ec33 100644
--- a/box-drawing.c
+++ b/box-drawing.c
@@ -27,9 +27,9 @@ struct buf {
int dpi;
float cell_size;
float base_thickness;
+ bool solid_shades;
};
-static const bool solid_shades = true; /* TODO: configurable? */
static const pixman_color_t white = {0xffff, 0xffff, 0xffff, 0xffff};
static void
@@ -1756,12 +1756,12 @@ draw_light_shade(struct buf *buf)
{
pixman_format_code_t fmt = pixman_image_get_format(buf->pix);
- if (solid_shades && fmt == PIXMAN_a1)
+ if (buf->solid_shades && fmt == PIXMAN_a1)
change_buffer_format(buf, PIXMAN_a8);
- else if (!solid_shades && fmt == PIXMAN_a8)
+ else if (!buf->solid_shades && fmt == PIXMAN_a8)
change_buffer_format(buf, PIXMAN_a1);
- if (solid_shades)
+ if (buf->solid_shades)
draw_pixman_shade(buf, 0x2000);
else {
for (size_t row = 0; row < buf->height; row += 2) {
@@ -1779,12 +1779,12 @@ draw_medium_shade(struct buf *buf)
{
pixman_format_code_t fmt = pixman_image_get_format(buf->pix);
- if (solid_shades && fmt == PIXMAN_a1)
+ if (buf->solid_shades && fmt == PIXMAN_a1)
change_buffer_format(buf, PIXMAN_a8);
- else if (!solid_shades && fmt == PIXMAN_a8)
+ else if (!buf->solid_shades && fmt == PIXMAN_a8)
change_buffer_format(buf, PIXMAN_a1);
- if (solid_shades)
+ if (buf->solid_shades)
draw_pixman_shade(buf, 0x4000);
else {
for (size_t row = 0; row < buf->height; row++) {
@@ -1802,12 +1802,12 @@ draw_dark_shade(struct buf *buf)
{
pixman_format_code_t fmt = pixman_image_get_format(buf->pix);
- if (solid_shades && fmt == PIXMAN_a1)
+ if (buf->solid_shades && fmt == PIXMAN_a1)
change_buffer_format(buf, PIXMAN_a8);
- else if (!solid_shades && fmt == PIXMAN_a8)
+ else if (!buf->solid_shades && fmt == PIXMAN_a8)
change_buffer_format(buf, PIXMAN_a1);
- if (solid_shades)
+ if (buf->solid_shades)
draw_pixman_shade(buf, 0x8000);
else {
for (size_t row = 0; row < buf->height; row++) {
@@ -2440,6 +2440,7 @@ box_drawing(const struct terminal *term, wchar_t wc)
.dpi = term->font_dpi,
.cell_size = sqrt(pow(term->cell_width, 2) + pow(term->cell_height, 2)),
.base_thickness = term->conf->tweak.box_drawing_base_thickness,
+ .solid_shades = term->conf->tweak.box_drawing_solid_shades,
};
LOG_DBG("LIGHT=%d, HEAVY=%d",
diff --git a/config.c b/config.c
index 66a4cc81..0f8f5aec 100644
--- a/config.c
+++ b/config.c
@@ -1929,6 +1929,14 @@ parse_section_tweak(
conf->tweak.box_drawing_base_thickness);
}
+ else if (strcmp(key, "box-drawing-solid-shades") == 0) {
+ conf->tweak.box_drawing_solid_shades = str_to_bool(value);
+
+ if (!conf->tweak.box_drawing_solid_shades)
+ LOG_WARN("tweak: box-drawing-solid-shades=%s",
+ conf->tweak.box_drawing_solid_shades ? "yes" : "no");
+ }
+
else {
LOG_AND_NOTIFY_ERR("%s:%u: [tweak]: %s: invalid key", path, lineno, key);
return false;
@@ -2396,6 +2404,7 @@ config_load(struct config *conf, const char *conf_path,
.render_timer_log = false,
.damage_whole_window = false,
.box_drawing_base_thickness = 0.04,
+ .box_drawing_solid_shades = true,
},
.notifications = tll_init(),
diff --git a/config.h b/config.h
index db0e6775..a5a47ce6 100644
--- a/config.h
+++ b/config.h
@@ -229,6 +229,7 @@ struct config {
uint64_t delayed_render_upper_ns;
off_t max_shm_pool_size;
float box_drawing_base_thickness;
+ bool box_drawing_solid_shades;
} tweak;
user_notifications_t notifications;
diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd
index abe90fc7..cb4b4f08 100644
--- a/doc/foot.ini.5.scd
+++ b/doc/foot.ini.5.scd
@@ -809,6 +809,16 @@ any of these options.
larger font (and thus larger cells) result in thicker
lines. Default: _0.04_.
+*box-drawing-solid-shades*
+ Boolean. When enabled, box drawing "shades" (e.g. LIGHT SHADE,
+ MEDIUM SHADE and DARK SHADE) are rendered as solid blocks using a
+ darker variant of the current foreground color.
+
+ When disabled, they are instead rendered as checker box pattern,
+ using the current foreground color as is.
+
+ Default: _yes_.
+
*delayed-render-lower*, *delayed-render-upper*
These two values control the timeouts (in nanoseconds) that are
used to mitigate screen flicker caused by clients writing large,