[vlc-devel] [PATCH] bluray: register mouse callbacks only once

Petri Hintukainen phintuka at gmail.com
Fri Dec 11 14:00:28 CET 2015


---
 modules/access/bluray.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 388c08c..8d13c89 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -2074,8 +2074,13 @@ static void blurayHandleOverlays(demux_t *p_demux, int nread)
         bool display = ov->status == ToDisplay;
         vlc_mutex_unlock(&ov->lock);
         if (display) {
-            if (p_sys->p_vout == NULL)
+            if (p_sys->p_vout == NULL) {
                 p_sys->p_vout = input_GetVout(p_demux->p_input);
+                if (p_sys->p_vout != NULL) {
+                    var_AddCallback(p_sys->p_vout, "mouse-moved", onMouseEvent, p_demux);
+                    var_AddCallback(p_sys->p_vout, "mouse-clicked", onMouseEvent, p_demux);
+                }
+            }
 
             /* NOTE: we might want to enable background video always when there's no video stream playing.
                Now, with some discs, there are perioids (even seconds) during which the video window
@@ -2092,8 +2097,6 @@ static void blurayHandleOverlays(demux_t *p_demux, int nread)
             }
 
             if (p_sys->p_vout != NULL) {
-                var_AddCallback(p_sys->p_vout, "mouse-moved", onMouseEvent, p_demux);
-                var_AddCallback(p_sys->p_vout, "mouse-clicked", onMouseEvent, p_demux);
                 bluraySendOverlayToVout(p_demux, ov);
             }
         }
-- 
2.5.0



More information about the vlc-devel mailing list