[MPlayer-cvslog] r31091 - in trunk/libvo: video_out.c video_out.h vo_corevideo.m w32_common.c x11_common.c
reimar
subversion at mplayerhq.hu
Sun Apr 25 18:13:57 CEST 2010
Author: reimar
Date: Sun Apr 25 18:13:57 2010
New Revision: 31091
Log:
Avoid duplicating mouse-movement command-generation code.
Modified:
trunk/libvo/video_out.c
trunk/libvo/video_out.h
trunk/libvo/vo_corevideo.m
trunk/libvo/w32_common.c
trunk/libvo/x11_common.c
Modified: trunk/libvo/video_out.c
==============================================================================
--- trunk/libvo/video_out.c Sun Apr 25 18:09:56 2010 (r31090)
+++ trunk/libvo/video_out.c Sun Apr 25 18:13:57 2010 (r31091)
@@ -446,6 +446,21 @@ void calc_src_dst_rects(int src_width, i
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*/
Modified: trunk/libvo/video_out.h
==============================================================================
--- trunk/libvo/video_out.h Sun Apr 25 18:09:56 2010 (r31090)
+++ trunk/libvo/video_out.h Sun Apr 25 18:13:57 2010 (r31091)
@@ -281,6 +281,7 @@ struct vo_rect {
};
void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst,
struct vo_rect *borders, const struct vo_rect *crop);
+void vo_mouse_movement(int posx, int posy);
static inline int aspect_scaling(void)
{
Modified: trunk/libvo/vo_corevideo.m
==============================================================================
--- trunk/libvo/vo_corevideo.m Sun Apr 25 18:09:56 2010 (r31090)
+++ trunk/libvo/vo_corevideo.m Sun Apr 25 18:13:57 2010 (r31091)
@@ -953,11 +953,8 @@ static int control(uint32_t request, voi
if (enable_mouse_movements && !isRootwin) {
NSPoint p =[self convertPoint:[theEvent locationInWindow] fromView:nil];
if ([self mouse:p inRect:textureFrame]) {
- char cmdstr[40];
- snprintf(cmdstr, sizeof(cmdstr), "set_mouse_pos %i %i",
- (int)(vo_fs ? p.x : (p.x - textureFrame.origin.x)),
- (int)(vo_fs ? [self frame].size.height - p.y: (NSMaxY(textureFrame) - p.y)));
- mp_input_queue_cmd(mp_input_parse_cmd(cmdstr));
+ vo_mouse_movement(vo_fs ? p.x : p.x - textureFrame.origin.x,
+ vo_fs ? [self frame].size.height - p.y : NSMaxY(textureFrame) - p.y);
}
}
}
Modified: trunk/libvo/w32_common.c
==============================================================================
--- trunk/libvo/w32_common.c Sun Apr 25 18:09:56 2010 (r31090)
+++ trunk/libvo/w32_common.c Sun Apr 25 18:13:57 2010 (r31091)
@@ -159,12 +159,7 @@ static LRESULT CALLBACK WndProc(HWND hWn
mplayer_put_key(MOUSE_BTN2);
break;
case WM_MOUSEMOVE:
- if (enable_mouse_movements) {
- char cmd_str[40];
- snprintf(cmd_str, sizeof(cmd_str), "set_mouse_pos %i %i",
- GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
- mp_input_queue_cmd(mp_input_parse_cmd(cmd_str));
- }
+ vo_mouse_movement(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
break;
case WM_MOUSEWHEEL:
if (!vo_nomouse_input) {
Modified: trunk/libvo/x11_common.c
==============================================================================
--- trunk/libvo/x11_common.c Sun Apr 25 18:09:56 2010 (r31090)
+++ trunk/libvo/x11_common.c Sun Apr 25 18:13:57 2010 (r31091)
@@ -873,12 +873,7 @@ int vo_x11_check_events(Display * mydisp
}
break;
case MotionNotify:
- if(enable_mouse_movements)
- {
- char cmd_str[40];
- sprintf(cmd_str,"set_mouse_pos %i %i",Event.xmotion.x, Event.xmotion.y);
- mp_input_queue_cmd(mp_input_parse_cmd(cmd_str));
- }
+ vo_mouse_movement(Event.xmotion.x, Event.xmotion.y);
if (vo_mouse_autohide)
{
More information about the MPlayer-cvslog
mailing list