input: use a timer fd to handle keyboard key repeat

Instead of running a repeater thread that writes the key to repeat
over a pipe, use a simple timer fd.

No more locking or condition signalling. No need to track
start/stop/exist states.

We simply set up the initial timeout value to be the 'delay', and the
interval to be the repeat 'rate'.
This commit is contained in:
Daniel Eklöf 2019-08-05 19:33:01 +02:00
parent c62ce72778
commit a82f12dd2b
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 65 additions and 156 deletions

View file

@ -156,12 +156,7 @@ struct kbd {
struct xkb_compose_table *xkb_compose_table;
struct xkb_compose_state *xkb_compose_state;
struct {
mtx_t mutex;
cnd_t cond;
int trigger;
int pipe_read_fd;
int pipe_write_fd;
enum {REPEAT_STOP, REPEAT_START, REPEAT_EXIT} cmd;
int fd;
bool dont_re_repeat;
int32_t delay;