diff libvo/video_out.c @ 31049:b40e41324173

Avoid duplicating mouse-movement command-generation code.
author reimar
date Sun, 25 Apr 2010 16:13:57 +0000
parents fca6cfc4d5ca
children aaaef13c84b9
line wrap: on
line diff
--- a/libvo/video_out.c	Sun Apr 25 16:09:56 2010 +0000
+++ b/libvo/video_out.c	Sun Apr 25 16:13:57 2010 +0000
@@ -446,6 +446,21 @@
   dst->height = dst->bottom - dst->top;
 }
 
+/**
+ * Generates a mouse movement message if those are enable and sends it
+ * to the "main" MPlayer.
+ *
+ * \param posx new x position of mouse
+ * \param posy new y position of mouse
+ */
+void vo_mouse_movement(int posx, int posy) {
+  char cmd_str[40];
+  if (!enable_mouse_movements)
+    return;
+  snprintf(cmd_str, sizeof(cmd_str), "set_mouse_pos %i %i", posx, posy);
+  mp_input_queue_cmd(mp_input_parse_cmd(cmd_str));
+}
+
 #if defined(CONFIG_FBDEV) || defined(CONFIG_VESA)
 /* Borrowed from vo_fbdev.c
 Monitor ranges related functions*/