mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-08 08:20:59 -04:00
config: promote tweak.resize-delay-ms to a real, supported option
This commit is contained in:
parent
7cba42c5ce
commit
3a7588bc99
6 changed files with 39 additions and 38 deletions
|
|
@ -67,7 +67,7 @@
|
||||||
requires 100ms of idle time (where the window size does not change)
|
requires 100ms of idle time (where the window size does not change)
|
||||||
before sending the new dimensions to the client application. The
|
before sending the new dimensions to the client application. The
|
||||||
timing can be tweaked, or completely disabled, by setting
|
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
|
### Deprecated
|
||||||
|
|
|
||||||
28
config.c
28
config.c
|
|
@ -523,6 +523,19 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
||||||
conf->center = center;
|
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)
|
else if (strcmp(key, "bold-text-in-bright") == 0)
|
||||||
conf->bold_in_bright = str_to_bool(value);
|
conf->bold_in_bright = str_to_bool(value);
|
||||||
|
|
||||||
|
|
@ -1745,19 +1758,6 @@ parse_section_tweak(
|
||||||
conf->tweak.box_drawing_base_thickness);
|
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 {
|
else {
|
||||||
LOG_AND_NOTIFY_ERR("%s:%u: [tweak]: %s: invalid key", path, lineno, key);
|
LOG_AND_NOTIFY_ERR("%s:%u: [tweak]: %s: invalid key", path, lineno, key);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -2093,6 +2093,7 @@ config_load(struct config *conf, const char *conf_path,
|
||||||
},
|
},
|
||||||
.pad_x = 2,
|
.pad_x = 2,
|
||||||
.pad_y = 2,
|
.pad_y = 2,
|
||||||
|
.resize_delay_ms = 100,
|
||||||
.bold_in_bright = false,
|
.bold_in_bright = false,
|
||||||
.bell_action = BELL_ACTION_NONE,
|
.bell_action = BELL_ACTION_NONE,
|
||||||
.startup_mode = STARTUP_WINDOWED,
|
.startup_mode = STARTUP_WINDOWED,
|
||||||
|
|
@ -2179,7 +2180,6 @@ config_load(struct config *conf, const char *conf_path,
|
||||||
.render_timer_log = false,
|
.render_timer_log = false,
|
||||||
.damage_whole_window = false,
|
.damage_whole_window = false,
|
||||||
.box_drawing_base_thickness = 0.04,
|
.box_drawing_base_thickness = 0.04,
|
||||||
.resize_delay_ms = 100,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
.notifications = tll_init(),
|
.notifications = tll_init(),
|
||||||
|
|
|
||||||
2
config.h
2
config.h
|
|
@ -77,6 +77,7 @@ struct config {
|
||||||
unsigned pad_x;
|
unsigned pad_x;
|
||||||
unsigned pad_y;
|
unsigned pad_y;
|
||||||
bool center;
|
bool center;
|
||||||
|
uint16_t resize_delay_ms;
|
||||||
|
|
||||||
bool bold_in_bright;
|
bool bold_in_bright;
|
||||||
enum {
|
enum {
|
||||||
|
|
@ -203,7 +204,6 @@ struct config {
|
||||||
uint64_t delayed_render_upper_ns;
|
uint64_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;
|
||||||
uint16_t resize_delay_ms;
|
|
||||||
} tweak;
|
} tweak;
|
||||||
|
|
||||||
user_notifications_t notifications;
|
user_notifications_t notifications;
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,25 @@ in this order:
|
||||||
|
|
||||||
Default: _2x2_.
|
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-size-pixels*
|
||||||
Initial window width and height in _pixels_ (subject to output
|
Initial window width and height in _pixels_ (subject to output
|
||||||
scaling), on the form _WIDTHxHEIGHT_. The height _includes_ the
|
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
|
larger font (and thus larger cells) result in thicker
|
||||||
lines. Default: _0.04_.
|
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*
|
*delayed-render-lower*, *delayed-render-upper*
|
||||||
These two values control the timeouts (in nanoseconds) that are
|
These two values control the timeouts (in nanoseconds) that are
|
||||||
used to mitigate screen flicker caused by clients writing large,
|
used to mitigate screen flicker caused by clients writing large,
|
||||||
|
|
|
||||||
1
foot.ini
1
foot.ini
|
|
@ -18,6 +18,7 @@
|
||||||
# initial-window-size-chars=<COLSxROWS>
|
# initial-window-size-chars=<COLSxROWS>
|
||||||
# initial-window-mode=windowed
|
# initial-window-mode=windowed
|
||||||
# pad=2x2 # optionally append 'center'
|
# pad=2x2 # optionally append 'center'
|
||||||
|
# resize-delay-ms=100
|
||||||
|
|
||||||
# bold-text-in-bright=no
|
# bold-text-in-bright=no
|
||||||
# bell=none
|
# bell=none
|
||||||
|
|
|
||||||
6
render.c
6
render.c
|
|
@ -2581,7 +2581,7 @@ send_dimensions_to_client(struct terminal *term)
|
||||||
{
|
{
|
||||||
struct wl_window *win = term->window;
|
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 */
|
/* Send new dimensions to client immediately */
|
||||||
tiocswinsz(term);
|
tiocswinsz(term);
|
||||||
|
|
||||||
|
|
@ -2592,10 +2592,10 @@ send_dimensions_to_client(struct terminal *term)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Send new dimensions to client “in a while” */
|
/* 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;
|
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;
|
bool successfully_scheduled = false;
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue