[vlc-commits] [Git][videolan/vlc][master] 3 commits: vout: indicate whether mouse event was consumed by vout_FilterMouse

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri May 23 07:32:52 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
bf6207c0 by Ayush Dey at 2025-05-23T07:19:05+00:00
vout: indicate whether mouse event was consumed by vout_FilterMouse

Update the prototype of vout_FilterMouse to return true if any filter in the chain
consumes the mouse event, and false otherwise. This will be used in the next commit
to stop mouse event propagation when consumed by any video filter.

- - - - -
9331c7e7 by Ayush Dey at 2025-05-23T07:19:05+00:00
vout: stop propagation if mouse event is consumed by a video filter

Adjust the consumer order to prioritize fullscreen toggling before vout_FilterMouse,
ensuring that double-click toggles fullscreen even when interactive video filters
(like puzzle, magnify, etc.) are active.
Remove vlc_mouse_HasMouseFilter and vlc_mouse_SetMouseFilter calls.

- - - - -
c894b81d by Ayush Dey at 2025-05-23T07:19:05+00:00
vlc_mouse: remove unused functions and member

Reverts 102e095d239d5076833b0baf5aa8956cba4ddb9f and c4076d307772fe2a79dfb5696a309e214ebc1248

- - - - -


8 changed files:

- include/vlc_filter.h
- include/vlc_mouse.h
- src/input/es_out.c
- src/libvlccore.sym
- src/misc/filter_chain.c
- src/video_output/video_output.c
- src/video_output/video_window.c
- src/video_output/vout_internal.h


Changes:

=====================================
include/vlc_filter.h
=====================================
@@ -585,15 +585,6 @@ VLC_API void filter_chain_DeleteFilter(filter_chain_t *chain,
  */
 VLC_API bool filter_chain_IsEmpty(const filter_chain_t *chain);
 
-/**
- * Checks whether the filter chain contains any video filters listening to
- * mouse events.
- *
- * \param chain pointer to filter chain
- * \return true if at least one filter listens to mouse events
- */
-VLC_API bool filter_chain_HasMouseFilter( const filter_chain_t *chain );
-
 /**
  * Get last output format of the last element in the filter chain.
  *


=====================================
include/vlc_mouse.h
=====================================
@@ -50,8 +50,6 @@ typedef struct vlc_mouse_t
     int i_pressed;
     /* Is double clicked */
     bool b_double_click;
-    /* Has filter listening to mouse events */
-    bool b_mouse_filter;
 } vlc_mouse_t;
 
 /**
@@ -68,7 +66,6 @@ static inline void vlc_mouse_Init( vlc_mouse_t *p_mouse )
     p_mouse->i_y = 0;
     p_mouse->i_pressed = 0;
     p_mouse->b_double_click = false;
-    p_mouse->b_mouse_filter = false;
 }
 
 /* */
@@ -89,12 +86,6 @@ static inline void vlc_mouse_SetPosition( vlc_mouse_t *p_mouse,
     p_mouse->i_y = i_y;
 }
 
-static inline void vlc_mouse_SetMouseFilter( vlc_mouse_t *p_mouse,
-                                             bool mouse_filter )
-{
-    p_mouse->b_mouse_filter = mouse_filter;
-}
-
 /* */
 static inline bool vlc_mouse_IsPressed( const vlc_mouse_t *p_mouse,
                                         int i_button )
@@ -166,9 +157,5 @@ static inline bool vlc_mouse_HasReleased( const vlc_mouse_t *p_old,
     const int i_mask = 1 << i_button;
     return (p_old->i_pressed & i_mask) && (p_new->i_pressed & i_mask) == 0;
 }
-static inline bool vlc_mouse_HasMouseFilter( const vlc_mouse_t *p_mouse )
-{
-    return p_mouse->b_mouse_filter;
-}
 #endif /* _VLC_MOUSE_H */
 


=====================================
src/input/es_out.c
=====================================
@@ -340,8 +340,7 @@ static void MouseEventCb(const vlc_mouse_t *newmouse, void *userdata)
     if(!p_sys->p_input)
         return;
 
-    /* player event is disabled when a filter is listening to mouse events */
-    if(!newmouse || vlc_mouse_HasMouseFilter(newmouse))
+    if(!newmouse)
     {
         vlc_mouse_Init(&id->oldmouse);
         id->mouse_being_dragged = false;


=====================================
src/libvlccore.sym
=====================================
@@ -130,7 +130,6 @@ filter_chain_DeleteFilter
 filter_chain_GetFmtOut
 filter_chain_GetVideoCtxOut
 filter_chain_IsEmpty
-filter_chain_HasMouseFilter
 filter_chain_MouseFilter
 filter_chain_NewVideo
 filter_chain_Reset


=====================================
src/misc/filter_chain.c
=====================================
@@ -467,19 +467,6 @@ bool filter_chain_IsEmpty(const filter_chain_t *chain)
     return vlc_list_is_empty( &chain->filter_list );
 }
 
-bool filter_chain_HasMouseFilter( const filter_chain_t *chain )
-{
-    const chained_filter_t *f;
-    vlc_list_foreach_const( f, &chain->filter_list, node )
-    {
-        const filter_t *p_filter = &f->filter;
-
-        if( p_filter->ops->video_mouse )
-            return true;
-    }
-    return false;
-}
-
 const es_format_t *filter_chain_GetFmtOut( const filter_chain_t *p_chain )
 {
     chained_filter_t *last =


=====================================
src/video_output/video_output.c
=====================================
@@ -302,10 +302,11 @@ void vout_DisplayTitle(vout_thread_t *vout, const char *title)
                  VLC_TICK_FROM_MS(sys->title.timeout), title);
 }
 
-void vout_FilterMouse(vout_thread_t *vout, vlc_mouse_t *mouse)
+bool vout_FilterMouse(vout_thread_t *vout, vlc_mouse_t *mouse)
 {
     vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout);
     vlc_mouse_t tmp[2], *m = mouse;
+    bool event_consumed = false;
 
     /* Pass mouse events through the filter chains. */
     vlc_mutex_lock(&sys->filter.lock);
@@ -314,18 +315,20 @@ void vout_FilterMouse(vout_thread_t *vout, vlc_mouse_t *mouse)
         if (!filter_chain_MouseFilter(sys->filter.chain_interactive,
                                       &tmp[0], m))
             m = &tmp[0];
+        else
+            event_consumed = true;
         if (!filter_chain_MouseFilter(sys->filter.chain_static,
                                       &tmp[1], m))
             m = &tmp[1];
-
-        bool has_mouse_filter = filter_chain_HasMouseFilter(sys->filter.chain_interactive) ||
-                                filter_chain_HasMouseFilter(sys->filter.chain_static);
-        vlc_mouse_SetMouseFilter(m, has_mouse_filter);
+        else
+            event_consumed = true;
     }
     vlc_mutex_unlock(&sys->filter.lock);
 
     if (mouse != m)
         *mouse = *m;
+
+    return event_consumed;
 }
 
 void vout_PutSubpicture( vout_thread_t *vout, subpicture_t *subpic )


=====================================
src/video_output/video_window.c
=====================================
@@ -193,7 +193,12 @@ static void vout_display_window_MouseEvent(vlc_window_t *window,
                                           &state->format, &state->display);
     vlc_mutex_unlock(&state->lock);
 
-    vout_FilterMouse(vout, &video_mouse);
+    if (video_mouse.b_double_click && vlc_mouse_IsLeftPressed(&video_mouse))
+        var_ToggleBool(vout, "fullscreen");
+
+    /* Stop propagation if the event was consumed by a video filter */
+    if (vout_FilterMouse(vout, &video_mouse))
+        return;
 
     /* Check if the mouse state actually changed and emit events. */
     /* NOTE: sys->mouse is only used here, so no need to lock. */
@@ -201,8 +206,6 @@ static void vout_display_window_MouseEvent(vlc_window_t *window,
         var_SetCoords(vout, "mouse-moved", m->i_x, m->i_y);
     if (vlc_mouse_HasButton(&state->mouse.video, &video_mouse))
         var_SetInteger(vout, "mouse-button-down", video_mouse.i_pressed);
-    if (video_mouse.b_double_click && vlc_mouse_IsLeftPressed(&video_mouse))
-        var_ToggleBool(vout, "fullscreen");
 
     state->mouse.video = video_mouse;
 


=====================================
src/video_output/vout_internal.h
=====================================
@@ -166,7 +166,12 @@ void vout_ChangeProjection(vout_thread_t *, video_projection_mode_t projection);
 void vout_ToggleProjection(vout_thread_t *, bool enabled);
 void vout_ResetProjection(vout_thread_t *);
 
-void vout_FilterMouse(vout_thread_t *vout, vlc_mouse_t *mouse);
+/**
+ * Passes mouse events through the video filter chains and updates the mouse state.
+ *
+ * \return true if any filter in the chain consumed the mouse event, false otherwise.
+ */
+bool vout_FilterMouse(vout_thread_t *vout, vlc_mouse_t *mouse);
 
 /* */
 void vout_CreateVars( vout_thread_t * );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d56f1e196b570a2e2893c31a0d593bab2b31b349...c894b81dec0ac918bdf063e8c941ad79ca4fb683

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d56f1e196b570a2e2893c31a0d593bab2b31b349...c894b81dec0ac918bdf063e8c941ad79ca4fb683
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list