diff options
author | wm4 <wm4@nowhere> | 2013-03-02 22:50:09 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-03-03 15:36:56 +0100 |
commit | ca893689fefdac74338b41aa21fbc601ae102ff6 (patch) | |
tree | dfab3405dffcf5327e8f624e7205bb36e3a066d4 /video/out/vo.c | |
parent | 9efe32120b4d5aaa88eccf4767fa7d7c5c700fd1 (diff) | |
download | mpv-ca893689fefdac74338b41aa21fbc601ae102ff6.tar.bz2 mpv-ca893689fefdac74338b41aa21fbc601ae102ff6.tar.xz |
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.
Diffstat (limited to 'video/out/vo.c')
-rw-r--r-- | video/out/vo.c | 25 |
1 files changed, 18 insertions, 7 deletions
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 <stdbool.h> #include <unistd.h> -//#include <sys/mman.h> + +#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); |