summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-20 12:00:44 +0000
committerulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-20 12:00:44 +0000
commit54cffe9bee9f16b239edee855e7fdd2770a98d94 (patch)
treed04301a26c959b9f302ee69a0778975bc198baa3 /libvo
parent278692c1bf1188a538f9e952352cc2c89f3a086a (diff)
downloadmpv-54cffe9bee9f16b239edee855e7fdd2770a98d94.tar.bz2
mpv-54cffe9bee9f16b239edee855e7fdd2770a98d94.tar.xz
Support send mouse movements commands to mplayer.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25474 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_macosx.m15
1 files changed, 13 insertions, 2 deletions
diff --git a/libvo/vo_macosx.m b/libvo/vo_macosx.m
index 1a19bb5580..273cba2dff 100644
--- a/libvo/vo_macosx.m
+++ b/libvo/vo_macosx.m
@@ -63,6 +63,7 @@ static int isRootwin;
extern float monitor_aspect;
extern float movie_aspect;
static float old_movie_aspect;
+extern int enable_mouse_movements;
static float winAlpha = 1;
static int int_pause = 0;
@@ -671,8 +672,6 @@ static int control(uint32_t request, void *data, ...)
int padding = 0;
NSRect frame = [self frame];
- vo_dwidth = frame.size.width;
- vo_dheight = frame.size.height;
glViewport(0, 0, frame.size.width, frame.size.height);
glMatrixMode(GL_PROJECTION);
@@ -705,6 +704,8 @@ static int control(uint32_t request, void *data, ...)
{
textureFrame = frame;
}
+ vo_dwidth = textureFrame.size.width;
+ vo_dheight = textureFrame.size.height;
}
/*
@@ -1004,6 +1005,16 @@ static int control(uint32_t request, void *data, ...)
CGDisplayShowCursor(kCGDirectMainDisplay);
mouseHide = NO;
}
+ if (enable_mouse_movements) {
+ 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));
+ }
+ }
}
- (void) mouseDown: (NSEvent *) theEvent