[vlc-commits] vout_macosx: fix mouse position in vout for retina displays (close #11214)

David Fuhrmann git at videolan.org
Sat Apr 19 11:36:59 CEST 2014


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sat Apr 19 11:36:03 2014 +0200| [aa7f483af169b67ed2e038993a4a5d48817a1d99] | committer: David Fuhrmann

vout_macosx: fix mouse position in vout for retina displays (close #11214)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=aa7f483af169b67ed2e038993a4a5d48817a1d99
---

 modules/video_output/macosx.m |   21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 46daebf..69e2788 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -770,24 +770,21 @@ static void OpenglSwap (vlc_gl_t *gl)
 
 - (void)mouseMoved:(NSEvent *)o_event
 {
-    NSPoint ml;
-    NSRect s_rect;
-    BOOL b_inside;
-
     /* on HiDPI displays, the point bounds don't equal the actual pixel based bounds */
-    if (OSX_LION)
-        s_rect = [self convertRectToBacking:[self bounds]];
-    else
-        s_rect = [self bounds];
-    ml = [self convertPoint: [o_event locationInWindow] fromView: nil];
-    b_inside = [self mouse: ml inRect: s_rect];
+    NSPoint ml = [self convertPoint: [o_event locationInWindow] fromView: nil];
+    NSRect videoRect = [self bounds];
+    BOOL b_inside = [self mouse: ml inRect: videoRect];
+
+    if (OSX_LION) {
+        ml = [self convertPointToBacking: ml];
+        videoRect = [self convertRectToBacking: videoRect];
+    }
 
     if (b_inside) {
         @synchronized (self) {
             if (vd) {
-
                 vout_display_SendMouseMovedDisplayCoordinates(vd, ORIENT_NORMAL,
-                                                              (int)ml.x, s_rect.size.height - (int)ml.y,
+                                                              (int)ml.x, videoRect.size.height - (int)ml.y,
                                                               &vd->sys->place);
             }
         }



More information about the vlc-commits mailing list