diff options
author | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-29 12:55:23 +0300 |
---|---|---|
committer | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-29 12:55:23 +0300 |
commit | 986e519fc9373e2b3dab6f86debcbd7e13466c34 (patch) | |
tree | 928eb75d2e6e5685fa468efe4e074a6825a197b9 /input/input.h | |
parent | b6b82964aa3f9ba93f6f284ed97c278743f50fce (diff) | |
download | mpv-986e519fc9373e2b3dab6f86debcbd7e13466c34.tar.bz2 mpv-986e519fc9373e2b3dab6f86debcbd7e13466c34.tar.xz |
input: Remove separate mp_input_add_event_fd
Use the same mp_input_add_key_fd for all uses and add a context
argument to its callback that was before only in the event fd
callbacks. Instead of checking in input.c whether keys were inserted
to the keypress FIFO during the callback do the check in the callback
before returning and set return value accordingly.
Diffstat (limited to 'input/input.h')
-rw-r--r-- | input/input.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/input/input.h b/input/input.h index 27c1bdb83f..4ee0376993 100644 --- a/input/input.h +++ b/input/input.h @@ -206,7 +206,7 @@ typedef struct mp_key_name { // the next key code or command. // These functions should return the key code or one of the error codes -typedef int (*mp_key_func_t)(int fd); +typedef int (*mp_key_func_t)(void *ctx, int fd); // These functions should act like read but they must use our error code (if needed ;-) typedef int (*mp_cmd_func_t)(int fd,char* dest,int size); // These are used to close the driver @@ -234,16 +234,12 @@ mp_input_rm_cmd_fd(int fd); // The args are the same as for the key's drivers. If you don't use any valid fd you MUST // give a read_func. int -mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func); +mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func, void *ctx); // As for the cmd one you usually don't need this function. void mp_input_rm_key_fd(int fd); -int mp_input_add_event_fd(int fd, void (*read_func)(void *ctx), void *ctx); - -void mp_input_rm_event_fd(int fd); - /// Get input key from its name. int mp_input_get_key_from_name(const char *name); |