mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-01 07:15:32 -04:00
config: use a bitfield for flags tracking whether to use custom colors for CSD or not
This commit is contained in:
parent
e9c3d03837
commit
ee1d179b8f
2 changed files with 9 additions and 9 deletions
8
config.h
8
config.h
|
|
@ -192,10 +192,10 @@ struct config {
|
||||||
int button_width;
|
int button_width;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool title_set;
|
bool title_set:1;
|
||||||
bool minimize_set;
|
bool minimize_set:1;
|
||||||
bool maximize_set;
|
bool maximize_set:1;
|
||||||
bool close_set;
|
bool close_set:1;
|
||||||
uint32_t title;
|
uint32_t title;
|
||||||
uint32_t minimize;
|
uint32_t minimize;
|
||||||
uint32_t maximize;
|
uint32_t maximize;
|
||||||
|
|
|
||||||
10
render.c
10
render.c
|
|
@ -1605,27 +1605,27 @@ render_csd_button(struct terminal *term, enum csd_surface surf_idx)
|
||||||
uint32_t _color;
|
uint32_t _color;
|
||||||
uint16_t alpha = 0xffff;
|
uint16_t alpha = 0xffff;
|
||||||
bool is_active = false;
|
bool is_active = false;
|
||||||
const bool *is_set = NULL;
|
bool is_set = false;
|
||||||
const uint32_t *conf_color = NULL;
|
const uint32_t *conf_color = NULL;
|
||||||
|
|
||||||
switch (surf_idx) {
|
switch (surf_idx) {
|
||||||
case CSD_SURF_MINIMIZE:
|
case CSD_SURF_MINIMIZE:
|
||||||
_color = term->colors.default_table[4]; /* blue */
|
_color = term->colors.default_table[4]; /* blue */
|
||||||
is_set = &term->conf->csd.color.minimize_set;
|
is_set = term->conf->csd.color.minimize_set;
|
||||||
conf_color = &term->conf->csd.color.minimize;
|
conf_color = &term->conf->csd.color.minimize;
|
||||||
is_active = term->active_surface == TERM_SURF_BUTTON_MINIMIZE;
|
is_active = term->active_surface == TERM_SURF_BUTTON_MINIMIZE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CSD_SURF_MAXIMIZE:
|
case CSD_SURF_MAXIMIZE:
|
||||||
_color = term->colors.default_table[2]; /* green */
|
_color = term->colors.default_table[2]; /* green */
|
||||||
is_set = &term->conf->csd.color.maximize_set;
|
is_set = term->conf->csd.color.maximize_set;
|
||||||
conf_color = &term->conf->csd.color.maximize;
|
conf_color = &term->conf->csd.color.maximize;
|
||||||
is_active = term->active_surface == TERM_SURF_BUTTON_MAXIMIZE;
|
is_active = term->active_surface == TERM_SURF_BUTTON_MAXIMIZE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CSD_SURF_CLOSE:
|
case CSD_SURF_CLOSE:
|
||||||
_color = term->colors.default_table[1]; /* red */
|
_color = term->colors.default_table[1]; /* red */
|
||||||
is_set = &term->conf->csd.color.close_set;
|
is_set = term->conf->csd.color.close_set;
|
||||||
conf_color = &term->conf->csd.color.close;
|
conf_color = &term->conf->csd.color.close;
|
||||||
is_active = term->active_surface == TERM_SURF_BUTTON_CLOSE;
|
is_active = term->active_surface == TERM_SURF_BUTTON_CLOSE;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1636,7 +1636,7 @@ render_csd_button(struct terminal *term, enum csd_surface surf_idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_active) {
|
if (is_active) {
|
||||||
if (*is_set) {
|
if (is_set) {
|
||||||
_color = *conf_color;
|
_color = *conf_color;
|
||||||
alpha = _color >> 24 | (_color >> 24 << 8);
|
alpha = _color >> 24 | (_color >> 24 << 8);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue