[vlc-devel] [PATCH 16/16] vout: win32: handle 360 user-interaction

Thomas Guillem thomas at gllm.fr
Wed Nov 9 18:33:10 CET 2016


These changes make sure that we handle mouse-dragging inside win32 for
projection modes that are not RECTANGULAR. We will swallow events that are to
be interpreted as viewpoint-change-requests, while making sure that others are
propagated to the core so that others can react to them.
---
 modules/video_output/win32/events.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/win32/events.c b/modules/video_output/win32/events.c
index c8003c3..c7c29de 100644
--- a/modules/video_output/win32/events.c
+++ b/modules/video_output/win32/events.c
@@ -174,6 +174,8 @@ static void *EventThread( void *p_this )
     {
         vout_display_place_t place;
         video_format_t       source;
+        int i_mouse_move_horizontal = 0;
+        int i_mouse_move_vertical = 0;
 
         if( !GetMessage( &msg, 0, 0, 0 ) )
         {
@@ -205,6 +207,8 @@ static void *EventThread( void *p_this )
             if( (abs(mouse_pos.x - old_mouse_pos.x) > 2 ||
                 (abs(mouse_pos.y - old_mouse_pos.y)) > 2 ) )
             {
+                i_mouse_move_horizontal = mouse_pos.x - old_mouse_pos.x;
+                i_mouse_move_vertical   = mouse_pos.y - old_mouse_pos.y;
                 old_mouse_pos = mouse_pos;
                 UpdateCursor( p_event, true );
             }
@@ -239,7 +243,14 @@ static void *EventThread( void *p_this )
                     (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);
+                if( vd->fmt.projection_mode == PROJECTION_MODE_RECTANGULAR
+                    || !(p_event->button_pressed & 0x1)
+                    || (i_mouse_move_horizontal == 0 && i_mouse_move_vertical == 0) )
+                    vout_display_SendEventMouseMoved(vd, x, y);
+                else
+                    vout_display_UpdateViewpoint( vd, &( vlc_viewpoint_t ) {
+                        .yaw   = -i_mouse_move_horizontal * 33,
+                        .pitch = -i_mouse_move_vertical * 25}, false );
             }
             break;
         case WM_NCMOUSEMOVE:
-- 
2.9.3



More information about the vlc-devel mailing list