Mercurial > mplayer.hg
changeset 36167:29fb09ef97b9
Avoid duplicating the mouse autohide code.
This also avoids calling vo_showcursor for every single
event and moves both parts of the autohide code closer
to each other.
author | reimar |
---|---|
date | Thu, 09 May 2013 14:06:18 +0000 |
parents | a6263abe514f |
children | 158f98b5f55a |
files | libvo/video_out.h libvo/x11_common.c |
diffstat | 2 files changed, 12 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/video_out.h Thu May 09 14:06:17 2013 +0000 +++ b/libvo/video_out.h Thu May 09 14:06:18 2013 +0000 @@ -35,6 +35,7 @@ #define VO_EVENT_KEYPRESS 4 #define VO_EVENT_REINIT 8 #define VO_EVENT_MOVE 16 +#define VO_EVENT_MOUSE 32 /* Obsolete: VOCTRL_QUERY_VAA 1 */ /* does the device support the required format */
--- a/libvo/x11_common.c Thu May 09 14:06:17 2013 +0000 +++ b/libvo/x11_common.c Thu May 09 14:06:18 2013 +0000 @@ -890,44 +890,26 @@ case MotionNotify: vo_mouse_movement(event->xmotion.x, event->xmotion.y); - if (vo_mouse_autohide) - { - vo_showcursor(mydisplay, vo_window); - mouse_waiting_hide = 1; - mouse_timer = GetTimerMS(); - } - break; + return VO_EVENT_MOUSE; case ButtonPress: - if (vo_mouse_autohide) - { - vo_showcursor(mydisplay, vo_window); - mouse_waiting_hide = 1; - mouse_timer = GetTimerMS(); - } #ifdef CONFIG_GUI // Ignore mouse button 1-3 under GUI. if (use_gui && (event->xbutton.button >= 1) && (event->xbutton.button <= 3)) - break; + return VO_EVENT_MOUSE; #endif mplayer_put_key((MOUSE_BTN0 + event->xbutton.button - 1) | MP_KEY_DOWN); - break; + return VO_EVENT_MOUSE; case ButtonRelease: - if (vo_mouse_autohide) - { - vo_showcursor(mydisplay, vo_window); - mouse_waiting_hide = 1; - mouse_timer = GetTimerMS(); - } #ifdef CONFIG_GUI // Ignore mouse button 1-3 under GUI. if (use_gui && (event->xbutton.button >= 1) && (event->xbutton.button <= 3)) - break; + return VO_EVENT_MOUSE; #endif mplayer_put_key(MOUSE_BTN0 + event->xbutton.button - 1); - break; + return VO_EVENT_MOUSE; case PropertyNotify: { char *name = @@ -977,6 +959,12 @@ XNextEvent(mydisplay, &Event); ret |= handle_x11_event(mydisplay, &Event); } + if (vo_mouse_autohide && (ret & VO_EVENT_MOUSE)) + { + vo_showcursor(mydisplay, vo_window); + mouse_waiting_hide = 1; + mouse_timer = GetTimerMS(); + } return ret; }