mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-28 06:46:38 -04:00
Refresh terminal after updating alpha
This commit is contained in:
parent
4e2347da12
commit
27f513920f
4 changed files with 16 additions and 12 deletions
|
|
@ -15,8 +15,6 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
#define clamp(x, lower, upper) (min(upper, max(x, lower)))
|
|
||||||
|
|
||||||
enum thickness {
|
enum thickness {
|
||||||
LIGHT,
|
LIGHT,
|
||||||
HEAVY,
|
HEAVY,
|
||||||
|
|
|
||||||
2
config.c
2
config.c
|
|
@ -1190,7 +1190,7 @@ parse_section_colors(struct context *ctx)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf->colors.alpha = alpha * 65535.;
|
conf->colors.alpha = alpha * UINT16_MAX;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2005,17 +2005,22 @@ term_font_size_reset(struct terminal *term)
|
||||||
return load_fonts_from_conf(term);
|
return load_fonts_from_conf(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ALPHA_STEP (0.05 * UINT16_MAX)
|
||||||
bool
|
bool
|
||||||
term_alpha_increase(struct terminal *term)
|
term_alpha_increase(struct terminal *term)
|
||||||
{
|
{
|
||||||
term->colors.alpha += 0.05;
|
term->colors.alpha = clamp(term->colors.alpha + ALPHA_STEP, 0, UINT16_MAX);
|
||||||
|
term->render.last_buf = NULL;
|
||||||
|
render_refresh(term);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
term_alpha_decrease(struct terminal *term)
|
term_alpha_decrease(struct terminal *term)
|
||||||
{
|
{
|
||||||
term->colors.alpha -= 0.05;
|
term->colors.alpha = clamp(term->colors.alpha - ALPHA_STEP, 0, UINT16_MAX);
|
||||||
|
term->render.last_buf = NULL;
|
||||||
|
render_refresh(term);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1
util.h
1
util.h
|
|
@ -6,6 +6,7 @@
|
||||||
#define ALEN(v) (sizeof(v) / sizeof((v)[0]))
|
#define ALEN(v) (sizeof(v) / sizeof((v)[0]))
|
||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
#define min(x, y) ((x) < (y) ? (x) : (y))
|
||||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
#define max(x, y) ((x) > (y) ? (x) : (y))
|
||||||
|
#define clamp(x, lower, upper) (min(upper, max(x, lower)))
|
||||||
|
|
||||||
static inline const char *
|
static inline const char *
|
||||||
thrd_err_as_string(int thrd_err)
|
thrd_err_as_string(int thrd_err)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue