From ca893689fefdac74338b41aa21fbc601ae102ff6 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 2 Mar 2013 22:50:09 +0100 Subject: x11_common: fix --cursor-autohide when paused When paused, --cursor-autohide worked with a precision of 500ms, which is the main loop's default sleep time when paused. Cursor hiding is polled in x11_common, and the main loop never called the X11 code at the right time. Fix this by allowing the VO to set a time when it should be called next. --- video/out/vo.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'video/out/vo.c') diff --git a/video/out/vo.c b/video/out/vo.c index 6fff185c6c..52ed04d3b5 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -25,11 +25,12 @@ #include #include -//#include + +#include "talloc.h" #include "config.h" +#include "osdep/timer.h" #include "core/options.h" -#include "talloc.h" #include "core/bstr.h" #include "vo.h" #include "aspect.h" @@ -41,11 +42,6 @@ #include "video/vfcap.h" #include "sub/sub.h" -#include "osdep/shmem.h" -#ifdef CONFIG_X11 -#include "x11_common.h" -#endif - int xinerama_x; int xinerama_y; @@ -247,6 +243,7 @@ void vo_flip_page(struct vo *vo, unsigned int pts_us, int duration) void vo_check_events(struct vo *vo) { + vo->next_wakeup_time = GetTimerMS() + 60 * 1000; if (!vo->config_ok) { if (vo->registered_fd != -1) mp_input_rm_key_fd(vo->input_ctx, vo->registered_fd); @@ -256,6 +253,20 @@ void vo_check_events(struct vo *vo) vo->driver->check_events(vo); } +// Return the amount of time vo_check_events() should be called in milliseconds. +// Note: video timing is completely separate from this. +unsigned int vo_get_sleep_time(struct vo *vo) +{ + unsigned int sleep = 60 * 1000; + if (vo->config_ok && vo->next_wakeup_time) { + unsigned int now = GetTimerMS(); + sleep = 0; + if (vo->next_wakeup_time >= now) + sleep = vo->next_wakeup_time - now; + } + return sleep; +} + void vo_seek_reset(struct vo *vo) { vo_control(vo, VOCTRL_RESET, NULL); -- cgit v1.2.3