config: promote tweak.resize-delay-ms to a real, supported option

This commit is contained in:
Daniel Eklöf 2021-01-21 15:14:43 +01:00
parent 7cba42c5ce
commit 3a7588bc99
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
6 changed files with 39 additions and 38 deletions

View file

@ -67,7 +67,7 @@
requires 100ms of idle time (where the window size does not change)
before sending the new dimensions to the client application. The
timing can be tweaked, or completely disabled, by setting
`tweak.resize-delay-ms` (https://codeberg.org/dnkl/foot/issues/301).
`resize-delay-ms` (https://codeberg.org/dnkl/foot/issues/301).
### Deprecated

View file

@ -523,6 +523,19 @@ parse_section_main(const char *key, const char *value, struct config *conf,
conf->center = center;
}
else if (strcmp(key, "resize-delay-ms") == 0) {
unsigned long ms;
if (!str_to_ulong(value, 10, &ms)) {
LOG_AND_NOTIFY_ERR(
"%s:%d: [default]: resize-delay-ms: "
"expected an integer, got '%s'",
path, lineno, value);
return false;
}
conf->resize_delay_ms = ms;
}
else if (strcmp(key, "bold-text-in-bright") == 0)
conf->bold_in_bright = str_to_bool(value);
@ -1745,19 +1758,6 @@ parse_section_tweak(
conf->tweak.box_drawing_base_thickness);
}
else if (strcmp(key, "resize-delay-ms") == 0) {
unsigned long ms;
if (!str_to_ulong(value, 10, &ms)) {
LOG_AND_NOTIFY_ERR(
"%s:%d: [tweak]: resize-delay-ms: expected an integer, got '%s'",
path, lineno, value);
return false;
}
conf->tweak.resize_delay_ms = ms;
LOG_WARN("tweak: resize-delay-ms=%hu", conf->tweak.resize_delay_ms);
}
else {
LOG_AND_NOTIFY_ERR("%s:%u: [tweak]: %s: invalid key", path, lineno, key);
return false;
@ -2093,6 +2093,7 @@ config_load(struct config *conf, const char *conf_path,
},
.pad_x = 2,
.pad_y = 2,
.resize_delay_ms = 100,
.bold_in_bright = false,
.bell_action = BELL_ACTION_NONE,
.startup_mode = STARTUP_WINDOWED,
@ -2179,7 +2180,6 @@ config_load(struct config *conf, const char *conf_path,
.render_timer_log = false,
.damage_whole_window = false,
.box_drawing_base_thickness = 0.04,
.resize_delay_ms = 100,
},
.notifications = tll_init(),

View file

@ -77,6 +77,7 @@ struct config {
unsigned pad_x;
unsigned pad_y;
bool center;
uint16_t resize_delay_ms;
bool bold_in_bright;
enum {
@ -203,7 +204,6 @@ struct config {
uint64_t delayed_render_upper_ns;
off_t max_shm_pool_size;
float box_drawing_base_thickness;
uint16_t resize_delay_ms;
} tweak;
user_notifications_t notifications;

View file

@ -131,6 +131,25 @@ in this order:
Default: _2x2_.
*resize-delay-ms*
Time, in milliseconds, of "idle time" "before foot sends the new
window dimensions to the client application while doing an
interactive resize of a foot window. Idle time in this context is
a period of time where the window size is not changing.
In other words, while you are fiddling with the window size, foot
does not send the updated dimensions to the client. Only when you
pause the fiddling for *relay-size-ms* milliseconds is the client
updated.
Emphasis is on _while_ here; as soon as the interactive resize
ends (i.e. when you let go of the window border), the final
dimensions is sent to the client, without any delays.
Setting it to 0 disables the delay completely.
Default: _100_.
*initial-window-size-pixels*
Initial window width and height in _pixels_ (subject to output
scaling), on the form _WIDTHxHEIGHT_. The height _includes_ the
@ -677,25 +696,6 @@ any of these options.
larger font (and thus larger cells) result in thicker
lines. Default: _0.04_.
*resize-delay-ms*
Time, in milliseconds, of "idle time" "before foot sends the new
window dimensions to the client application while doing an
interactive resize of a foot window. Idle time in this context is
a period of time where the window size is not changing.
In other words, while you are fiddling with the window size, foot
does not send the updated dimensions to the client. Only when you
pause the fiddling for *relay-size-ms* milliseconds is the client
updated.
Emphasis is on _while_ here; as soon as the interactive resize
ends (i.e. when you let go of the window border), the final
dimensions is sent to the client, without any delays.
Setting it to 0 disables the delay completely.
Default: _100_.
*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,

View file

@ -18,6 +18,7 @@
# initial-window-size-chars=<COLSxROWS>
# initial-window-mode=windowed
# pad=2x2 # optionally append 'center'
# resize-delay-ms=100
# bold-text-in-bright=no
# bell=none

View file

@ -2581,7 +2581,7 @@ send_dimensions_to_client(struct terminal *term)
{
struct wl_window *win = term->window;
if (!win->is_resizing || term->conf->tweak.resize_delay_ms == 0) {
if (!win->is_resizing || term->conf->resize_delay_ms == 0) {
/* Send new dimensions to client immediately */
tiocswinsz(term);
@ -2592,10 +2592,10 @@ send_dimensions_to_client(struct terminal *term)
}
} else {
/* Send new dimensions to client “in a while” */
assert(win->is_resizing && term->conf->tweak.resize_delay_ms > 0);
assert(win->is_resizing && term->conf->resize_delay_ms > 0);
int fd = win->resize_timeout_fd;
uint16_t delay_ms = term->conf->tweak.resize_delay_ms;
uint16_t delay_ms = term->conf->resize_delay_ms;
bool successfully_scheduled = false;
if (fd < 0) {