mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
input: don’t enable keyboard repeat timer when repeat rate is zero
wayland-client-protocol.h: Negative values for either rate or delay are illegal. A rate of zero will disable any repeating (regardless of the value of delay). This fixes a division-by-zero crash.
This commit is contained in:
parent
cebdae4bae
commit
67ac09ab2e
2 changed files with 4 additions and 0 deletions
3
input.c
3
input.c
|
|
@ -580,6 +580,9 @@ start_repeater(struct seat *seat, uint32_t key)
|
|||
if (seat->kbd.repeat.dont_re_repeat)
|
||||
return true;
|
||||
|
||||
if (seat->kbd.repeat.rate == 0)
|
||||
return true;
|
||||
|
||||
struct itimerspec t = {
|
||||
.it_value = {.tv_sec = 0, .tv_nsec = seat->kbd.repeat.delay * 1000000},
|
||||
.it_interval = {.tv_sec = 0, .tv_nsec = 1000000000 / seat->kbd.repeat.rate},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue