# HG changeset patch # User reimar # Date 1368108378 0 # Node ID 29fb09ef97b99e009d45cc30d9f463546ae1ee9a # Parent a6263abe514f5a40ee48b38247366ae4b7536289 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. diff -r a6263abe514f -r 29fb09ef97b9 libvo/video_out.h --- 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 */ diff -r a6263abe514f -r 29fb09ef97b9 libvo/x11_common.c --- 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; }