diff options
| author | phintuka <phintuka> | 2012-02-17 09:23:22 +0000 |
|---|---|---|
| committer | phintuka <phintuka> | 2012-02-17 09:23:22 +0000 |
| commit | 01e73abe88e8dafa789c09e6b18d1c846a5b2fc7 (patch) | |
| tree | a73a89e3288399cb61d990786ec6c95a0734e283 | |
| parent | af930b27a8a2a88d9629d35094f018eef5c3e417 (diff) | |
| download | xineliboutput-01e73abe88e8dafa789c09e6b18d1c846a5b2fc7.tar.gz xineliboutput-01e73abe88e8dafa789c09e6b18d1c846a5b2fc7.tar.bz2 | |
Fixed hiding mouse cursor
(Thanks to Roland Scheidegger)
The cursor never disappears because there seem to be incoming
xshm completion events every frame (for these events to arrive it is not
necessary to actually have xshm support compiled into vdr-sxfe), so
there's never a poll timeout and as a consequence the mousecursor
timeout never expires.
| -rw-r--r-- | xine_sxfe_frontend.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/xine_sxfe_frontend.c b/xine_sxfe_frontend.c index 7bbd4385..90983dd3 100644 --- a/xine_sxfe_frontend.c +++ b/xine_sxfe_frontend.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_sxfe_frontend.c,v 1.200 2012-02-17 07:44:25 phintuka Exp $ + * $Id: xine_sxfe_frontend.c,v 1.201 2012-02-17 09:23:22 phintuka Exp $ * */ @@ -61,6 +61,7 @@ #endif #include "tools/rle.h" +#include "tools/time_ms.h" #ifndef WIN_LAYER_NORMAL #define WIN_LAYER_NORMAL 4 @@ -2828,6 +2829,18 @@ static void XButtonEvent_handler(sxfe_t *this, XButtonEvent *bev) * * - main X event loop */ + +static void check_mouse_cursor_hide(sxfe_t *this, int64_t elapsed) +{ + if (elapsed > 0 && elapsed < 500) { + this->mousecursor_timeout -= elapsed; + if (this->mousecursor_timeout <= 0) { + // hide Cursor + set_cursor(this->display, this->window[this->fullscreen ? 1 : 0], 0); + } + } +} + static int sxfe_run(frontend_t *this_gen) { sxfe_t *this = (sxfe_t*)this_gen; @@ -2838,24 +2851,29 @@ static int sxfe_run(frontend_t *this_gen) * watchdog to emergency exit ... */ if (! XPending(this->display)) { + uint64_t poll_time = 0; const int poll_timeout = 50; struct pollfd pfd = { .fd = ConnectionNumber(this->display), .events = POLLIN, }; + + if (this->mousecursor_timeout > 0) { + poll_time = time_ms(); + } + if (poll(&pfd, 1, poll_timeout) < 1 || !(pfd.revents & POLLIN)) { - // timeout expired? if (this->mousecursor_timeout > 0) { - this->mousecursor_timeout -= poll_timeout; - if (this->mousecursor_timeout <= 0) { - // hide Cursor - set_cursor(this->display, this->window[this->fullscreen ? 1 : 0], 0); - } + check_mouse_cursor_hide(this, poll_timeout); } return !this->x.fe.xine_is_finished((frontend_t*)this, 0); } + + if (poll_time) { + check_mouse_cursor_hide(this, elapsed(poll_time)); + } } while (XPending(this->display) > 0) { |
