diff options
author | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-04 03:26:33 +0300 |
---|---|---|
committer | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-23 13:41:04 +0300 |
commit | e5e8effca82c24cdf4e15f91cc6fe29893ac0675 (patch) | |
tree | 5f789b732fc23cab78c35b74a56155ecc5095325 /input/input.c | |
parent | 1f086d4376897683194530f7dfc24a42c3eca908 (diff) | |
download | mpv-e5e8effca82c24cdf4e15f91cc6fe29893ac0675.tar.bz2 mpv-e5e8effca82c24cdf4e15f91cc6fe29893ac0675.tar.xz |
Add a context argument to mp_input_add_event_fd callback
Diffstat (limited to 'input/input.c')
-rw-r--r-- | input/input.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/input/input.c b/input/input.c index d2df5195be..a49de3c229 100644 --- a/input/input.c +++ b/input/input.c @@ -507,6 +507,7 @@ typedef struct mp_input_fd { int fd; void* read_func; mp_close_func_t close_func; + void *ctx; unsigned eof : 1; unsigned drop : 1; unsigned dead : 1; @@ -691,7 +692,7 @@ mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t } int -mp_input_add_event_fd(int fd, void (*read_func)(void)) +mp_input_add_event_fd(int fd, void (*read_func)(void *ctx), void *ctx) { if(num_key_fd == MP_MAX_KEY_FD) { mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantRegister2ManyKeyFds,fd); @@ -705,6 +706,7 @@ mp_input_add_event_fd(int fd, void (*read_func)(void)) key_fds[num_key_fd] = (struct mp_input_fd){ .fd = fd, .read_func = read_func, + .ctx = ctx, .no_readfunc_retval = 1, }; num_key_fd++; @@ -1230,7 +1232,7 @@ static mp_cmd_t *read_events(int time, int paused) #endif if (key_fds[i].no_readfunc_retval) { // getch2 handler special-cased for now - ((void (*)(void))key_fds[i].read_func)(); + ((void (*)(void *))key_fds[i].read_func)(key_fds[i].ctx); if (cmd_queue_length) return NULL; code = mplayer_get_key(0); |