[vlc-commits] hotkeys: missing vout events (refs #20617)

Rémi Denis-Courmont git at videolan.org
Wed Jun 6 19:00:53 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jun  6 19:48:41 2018 +0300| [027d4c43bd0bd62728b20ddd4b59c03c22eb5f6a] | committer: Rémi Denis-Courmont

hotkeys: missing vout events (refs #20617)

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

 modules/control/hotkeys.c | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index a7a5792bb1..068db5e7f0 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -156,7 +156,7 @@ static int ButtonEvent( vlc_object_t *p_this, char const *psz_var,
 
     (void) psz_var;
 
-    if (newval.i_int & (1 << MOUSE_BUTTON_LEFT))
+    if ((newval.i_int & (1 << MOUSE_BUTTON_LEFT)) && p_sys->vrnav.b_can_change)
     {
         if( !p_sys->vrnav.b_button_pressed )
         {
@@ -218,26 +218,23 @@ static void ChangeVout( intf_thread_t *p_intf, vout_thread_t *p_vout )
     if( p_old_vout != NULL )
     {
         if( b_vrnav_could_change )
-        {
-            var_DelCallback( p_old_vout, "mouse-moved", MovedEvent,
-                             p_intf );
-            var_DelCallback( p_old_vout, "mouse-button-down", ButtonEvent,
-                             p_intf );
             var_DelCallback( p_old_vout, "viewpoint-moved", ViewpointMovedEvent,
                              p_intf );
-        }
+
+        var_DelCallback( p_old_vout, "mouse-button-down", ButtonEvent,
+                         p_intf );
+        var_DelCallback( p_old_vout, "mouse-moved", MovedEvent, p_intf );
         vlc_object_release( p_old_vout );
     }
 
-    if( p_sys->vrnav.b_can_change )
+    if( p_vout != NULL )
     {
-        assert( p_sys->p_vout != NULL );
-        var_AddCallback( p_sys->p_vout, "mouse-moved", MovedEvent,
-                         p_intf );
-        var_AddCallback( p_sys->p_vout, "mouse-button-down", ButtonEvent,
-                         p_intf );
-        var_AddCallback( p_sys->p_vout, "viewpoint-moved", ViewpointMovedEvent,
-                         p_intf );
+        var_AddCallback( p_vout, "mouse-moved", MovedEvent, p_intf );
+        var_AddCallback( p_vout, "mouse-button-down", ButtonEvent, p_intf );
+
+        if( p_sys->vrnav.b_can_change )
+            var_AddCallback( p_vout, "viewpoint-moved",
+                             ViewpointMovedEvent, p_intf );
     }
 }
 
@@ -270,13 +267,15 @@ static void ChangeInput( intf_thread_t *p_intf, input_thread_t *p_input )
         p_old_vout = p_sys->p_vout;
         /* Remove mouse events before setting new input, since callbacks may
          * access it */
-        if( p_old_vout != NULL && p_sys->vrnav.b_can_change )
+        if( p_old_vout != NULL )
         {
-            var_DelCallback( p_old_vout, "mouse-moved", MovedEvent,
-                             p_intf );
+            if( p_sys->vrnav.b_can_change )
+                var_DelCallback( p_old_vout, "viewpoint-moved",
+                                 ViewpointMovedEvent, p_intf );
+
             var_DelCallback( p_old_vout, "mouse-button-down", ButtonEvent,
                              p_intf );
-            var_DelCallback( p_old_vout, "viewpoint-moved", ViewpointMovedEvent,
+            var_DelCallback( p_old_vout, "mouse-moved", MovedEvent,
                              p_intf );
         }
     }



More information about the vlc-commits mailing list