[vlc-commits] macosx: fix mouse position sent to vlc core for menus
David Fuhrmann
git at videolan.org
Sat May 5 19:07:10 CEST 2012
vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sat May 5 19:02:21 2012 +0200| [2d2cde172f10a5290956a115b35cf693a945e559] | committer: David Fuhrmann
macosx: fix mouse position sent to vlc core for menus
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2d2cde172f10a5290956a115b35cf693a945e559
---
modules/gui/macosx/VideoView.m | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/modules/gui/macosx/VideoView.m b/modules/gui/macosx/VideoView.m
index 95c7128..0a6a530 100644
--- a/modules/gui/macosx/VideoView.m
+++ b/modules/gui/macosx/VideoView.m
@@ -313,7 +313,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)mouseMoved:(NSEvent *)o_event
{
vout_thread_t * p_vout = getVout();
- if (p_vout)
+ if( p_vout )
{
NSPoint ml;
NSRect s_rect;
@@ -325,7 +325,21 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
if( b_inside )
{
- vout_display_SendEventMouseMoved( [[[self subviews] objectAtIndex:0] voutDisplay], ((int)ml.x), ((int)s_rect.size.height - ((int)ml.y)) );
+ vout_display_t *vd = [[[self subviews] objectAtIndex:0] voutDisplay];
+
+ vout_display_place_t place;
+ vout_display_PlacePicture( &place, &vd->source, vd->cfg, false );
+
+ if( place.width > 0 && place.height > 0 )
+ {
+ const int x = vd->source.i_x_offset +
+ (int64_t)(ml.x - place.x) * vd->source.i_visible_width / place.width;
+ const int y = vd->source.i_y_offset +
+ (int64_t)((int)s_rect.size.height - (int)ml.y - place.y) * vd->source.i_visible_height / place.height;
+
+ vout_display_SendEventMouseMoved( vd, x, y );
+ }
+
[[VLCMain sharedInstance] showFullscreenController];
}
vlc_object_release( p_vout );
More information about the vlc-commits
mailing list