diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-12-14 21:58:47 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-12-14 22:33:12 +0200 |
commit | 4f610adfc29a2aa2f1159ded016ca4f8960c52e9 (patch) | |
tree | 260307218d658564e8430d8c61a12c14b920f804 /libvo/vo_xv.c | |
parent | 2ba074e613d79600023128974ea60a75251480b5 (diff) | |
download | mpv-4f610adfc29a2aa2f1159ded016ca4f8960c52e9.tar.bz2 mpv-4f610adfc29a2aa2f1159ded016ca4f8960c52e9.tar.xz |
libvo: register X11 connection fd in input event system
Register the X11 connection fd in the input system so that
mp_input_get_cmd() can immediately wake up and handle keyboard or
other X events. The callback calls vo_check_events() and tells the
input system to handle any input possibly recorded during that. Before
this was done for vo_xv only; this commit generalizes it to all VOs
that call vo_x11_create_vo_window() - those are hopefully ones that
will handle all X events in check_events().
The callback is only kept registered while the vo is properly
configured. At other times calling check_events() would not clear
pending input and so could lead to a busy loop.
Diffstat (limited to 'libvo/vo_xv.c')
-rw-r--r-- | libvo/vo_xv.c | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index 0dbc600847..63221782e2 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -61,9 +61,6 @@ Buffer allocation: #include "subopt-helper.h" -#include "input/input.h" -#include "mp_fifo.h" - #include "libavutil/common.h" static const vo_info_t info = { @@ -104,7 +101,6 @@ struct xvctx { struct vo_rect src_rect; struct vo_rect dst_rect; uint32_t max_width, max_height; // zero means: not set - int event_fd_registered; // for uninit called from preinit int mode_switched; int osd_objects_drawn; void (*draw_alpha_fnc)(void *ctx, int x0, int y0, int w, int h, @@ -645,19 +641,10 @@ static void uninit(struct vo *vo) if (ctx->mode_switched) vo_vm_close(vo); #endif - if (ctx->event_fd_registered) - mp_input_rm_key_fd(vo->input_ctx, ConnectionNumber(vo->x11->display)); // uninit() shouldn't get called unless initialization went past vo_init() vo_x11_uninit(vo); } -static int x11_fd_callback(void *ctx, int fd) -{ - struct vo *vo = ctx; - check_events(vo); - return mplayer_get_key(vo->key_fifo, 0); -} - static int preinit(struct vo *vo, const char *arg) { XvPortID xv_p; @@ -780,9 +767,6 @@ static int preinit(struct vo *vo, const char *arg) ctx->fo = XvListImageFormats(x11->display, x11->xv_port, (int *) &ctx->formats); - mp_input_add_key_fd(vo->input_ctx, ConnectionNumber(x11->display), 1, - x11_fd_callback, NULL, vo); - ctx->event_fd_registered = 1; return 0; error: |