[vlc-commits] msw: report mouse position in window coordinates

Rémi Denis-Courmont git at videolan.org
Mon Dec 31 18:37:08 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 31 15:52:55 2018 +0200| [7c4855832e436b4dbb380e05a96463df929880f9] | committer: Rémi Denis-Courmont

msw: report mouse position in window coordinates

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

 modules/video_output/win32/events.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/win32/events.c b/modules/video_output/win32/events.c
index b4df31da89..b88f16caa5 100644
--- a/modules/video_output/win32/events.c
+++ b/modules/video_output/win32/events.c
@@ -193,7 +193,6 @@ static void *EventThread( void *p_this )
     for( ;; )
     {
         vout_display_place_t place;
-        video_format_t       source;
 
         if( !GetMessage( &msg, 0, 0, 0 ) )
         {
@@ -240,22 +239,20 @@ static void *EventThread( void *p_this )
         case WM_MOUSEMOVE:
             vlc_mutex_lock( &p_event->lock );
             place  = p_event->place;
-            source = p_event->source;
             vlc_mutex_unlock( &p_event->lock );
 
             if( place.width > 0 && place.height > 0 )
             {
+                int x = GET_X_LPARAM(msg.lParam);
+                int y = GET_Y_LPARAM(msg.lParam);
+
                 if( msg.hwnd == p_event->hvideownd )
                 {
                     /* Child window */
-                    place.x = 0;
-                    place.y = 0;
+                    x += place.x;
+                    y += place.y;
                 }
-                const int x = source.i_x_offset +
-                    (int64_t)(GET_X_LPARAM(msg.lParam) - place.x) * source.i_width  / place.width;
-                const int y = source.i_y_offset +
-                    (int64_t)(GET_Y_LPARAM(msg.lParam) - place.y) * source.i_height / place.height;
-                vout_display_SendEventMouseMoved(vd, x, y);
+                vout_display_SendMouseMovedDisplayCoordinates(vd, x, y);
             }
             break;
         case WM_NCMOUSEMOVE:



More information about the vlc-commits mailing list