[MPlayer-cvslog] r36263 - in trunk/libvo: video_out.h x11_common.c

reimar subversion at mplayerhq.hu
Thu May 9 16:06:18 CEST 2013


Author: reimar
Date: Thu May  9 16:06:18 2013
New Revision: 36263

Log:
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.

Modified:
   trunk/libvo/video_out.h
   trunk/libvo/x11_common.c

Modified: trunk/libvo/video_out.h
==============================================================================
--- trunk/libvo/video_out.h	Thu May  9 16:06:17 2013	(r36262)
+++ trunk/libvo/video_out.h	Thu May  9 16:06:18 2013	(r36263)
@@ -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 */

Modified: trunk/libvo/x11_common.c
==============================================================================
--- trunk/libvo/x11_common.c	Thu May  9 16:06:17 2013	(r36262)
+++ trunk/libvo/x11_common.c	Thu May  9 16:06:18 2013	(r36263)
@@ -890,44 +890,26 @@ static int handle_x11_event(Display *myd
             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 @@ int vo_x11_check_events(Display * mydisp
         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;
 }
 


More information about the MPlayer-cvslog mailing list