Merge branch 'config-refactor'

This commit is contained in:
Daniel Eklöf 2021-11-13 11:04:54 +01:00
commit e026ef22f4
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
8 changed files with 722 additions and 817 deletions

View file

@ -59,6 +59,10 @@
* Foot now terminates if there are no available seats - for example, * Foot now terminates if there are no available seats - for example,
due to the compositor not implementing a recent enough version of due to the compositor not implementing a recent enough version of
the `wl_seat` interface (https://codeberg.org/dnkl/foot/issues/779). the `wl_seat` interface (https://codeberg.org/dnkl/foot/issues/779).
* Boolean options in `foot.ini` are now limited to
“yes|true|on|1|no|false|off|0”, Previously, anything that did not
match “yes|true|on”, or a number greater than 0, was treated as
“false”.
### Deprecated ### Deprecated

1496
config.c

File diff suppressed because it is too large Load diff

View file

@ -19,7 +19,7 @@ enum conf_size_type {CONF_SIZE_PX, CONF_SIZE_CELLS};
struct config_font { struct config_font {
char *pattern; char *pattern;
double pt_size; float pt_size;
int px_size; int px_size;
}; };
DEFINE_LIST(struct config_font); DEFINE_LIST(struct config_font);
@ -74,8 +74,8 @@ struct config {
struct { struct {
enum conf_size_type type; enum conf_size_type type;
unsigned width; uint32_t width;
unsigned height; uint32_t height;
} size; } size;
unsigned pad_x; unsigned pad_x;
@ -115,7 +115,7 @@ struct config {
} bell; } bell;
struct { struct {
int lines; uint32_t lines;
struct { struct {
enum { enum {
@ -132,7 +132,7 @@ struct config {
wchar_t *text; wchar_t *text;
} indicator; } indicator;
double multiplier; float multiplier;
} scrollback; } scrollback;
struct { struct {
@ -212,10 +212,10 @@ struct config {
struct { struct {
enum { CONF_CSD_PREFER_NONE, CONF_CSD_PREFER_SERVER, CONF_CSD_PREFER_CLIENT } preferred; enum { CONF_CSD_PREFER_NONE, CONF_CSD_PREFER_SERVER, CONF_CSD_PREFER_CLIENT } preferred;
int title_height; uint16_t title_height;
int border_width; uint16_t border_width;
int border_width_visible; uint16_t border_width_visible;
int button_width; uint16_t button_width;
struct { struct {
bool title_set:1; bool title_set:1;
@ -235,7 +235,7 @@ struct config {
struct config_font_list font; struct config_font_list font;
} csd; } csd;
size_t render_worker_count; uint16_t render_worker_count;
char *server_socket_path; char *server_socket_path;
bool presentation_timings; bool presentation_timings;
bool hold_at_exit; bool hold_at_exit;
@ -257,8 +257,8 @@ struct config {
bool render_timer_osd; bool render_timer_osd;
bool render_timer_log; bool render_timer_log;
bool damage_whole_window; bool damage_whole_window;
uint64_t delayed_render_lower_ns; uint32_t delayed_render_lower_ns;
uint64_t delayed_render_upper_ns; uint32_t delayed_render_upper_ns;
off_t max_shm_pool_size; off_t max_shm_pool_size;
float box_drawing_base_thickness; float box_drawing_base_thickness;
bool box_drawing_solid_shades; bool box_drawing_solid_shades;

View file

@ -894,9 +894,7 @@ This section is for advanced users and describes configuration options
that can be used to tweak foot's low-level behavior. that can be used to tweak foot's low-level behavior.
These options are *not* included in the example configuration. You These options are *not* included in the example configuration. You
should not change these unless you understand what they do and note should not change these unless you understand what they do.
that changing the default values *will* print a warning when launching
foot.
Note that these options may change, or be removed at any time, without Note that these options may change, or be removed at any time, without
prior notice. prior notice.

3
log.h
View file

@ -11,7 +11,8 @@ enum log_class {
LOG_CLASS_ERROR, LOG_CLASS_ERROR,
LOG_CLASS_WARNING, LOG_CLASS_WARNING,
LOG_CLASS_INFO, LOG_CLASS_INFO,
LOG_CLASS_DEBUG LOG_CLASS_DEBUG,
LOG_CLASS_COUNT,
}; };
void log_init(enum log_colorize colorize, bool do_syslog, void log_init(enum log_colorize colorize, bool do_syslog,

View file

@ -3538,7 +3538,7 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
term->height = height; term->height = height;
term->scale = scale; term->scale = scale;
const int scrollback_lines = term->render.scrollback_lines; const uint32_t scrollback_lines = term->render.scrollback_lines;
/* Screen rows/cols before resize */ /* Screen rows/cols before resize */
const int old_cols = term->cols; const int old_cols = term->cols;

View file

@ -580,7 +580,7 @@ fdm_title_update_timeout(struct fdm *fdm, int fd, int events, void *data)
static bool static bool
initialize_render_workers(struct terminal *term) initialize_render_workers(struct terminal *term)
{ {
LOG_INFO("using %zu rendering threads", term->render.workers.count); LOG_INFO("using %hu rendering threads", term->render.workers.count);
if (sem_init(&term->render.workers.start, 0, 0) < 0 || if (sem_init(&term->render.workers.start, 0, 0) < 0 ||
sem_init(&term->render.workers.done, 0, 0) < 0) sem_init(&term->render.workers.done, 0, 0) < 0)

View file

@ -526,7 +526,7 @@ struct terminal {
int timer_fd; int timer_fd;
} title; } title;
int scrollback_lines; /* Number of scrollback lines, from conf (TODO: move out from render struct?) */ uint32_t scrollback_lines; /* Number of scrollback lines, from conf (TODO: move out from render struct?) */
struct { struct {
bool enabled; bool enabled;
@ -535,7 +535,7 @@ struct terminal {
/* Render threads + synchronization primitives */ /* Render threads + synchronization primitives */
struct { struct {
size_t count; uint16_t count;
sem_t start; sem_t start;
sem_t done; sem_t done;
mtx_t lock; mtx_t lock;