]> git.sesse.net Git - vlc/commitdiff
"fullscreen" callback: do nothing if value is unchanged
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 10 Feb 2010 16:03:47 +0000 (18:03 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 10 Feb 2010 16:43:29 +0000 (18:43 +0200)
The old video output core assumes that the fullscreen state must be
toggled if the VOUT_FULLSCREEN_CHANGE bit is set. So we need to check
that the target state is not already correct, as the VLC variables core
does NOT do it internally. This commit provides rare exception to the
rule that oldval is useless.

This fixes a whole class of race conditions where two threads try to
change fullscreen status at the same time.

In the video filter case, we now enable fullscreen on all childrens, not
just one. This seems a bit more logical for wall. Without this, toggling
fullscreen would only ever work on the first video output. With this,
things should work great if the different pieces of the wall are on
different video ports, and OK (Alt+Tab is your friend) otherwise.

modules/control/hotkeys.c
modules/video_filter/filter_common.h
modules/video_filter/wrapper.c
src/video_output/event.h
src/video_output/vout_intf.c

index f50b9952c0188a0b58eb5b82d908db4afe6d572b..8f7c3f556f32c09772444d357d20eae887ade891 100644 (file)
@@ -236,7 +236,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
         }
 
         case ACTIONID_LEAVE_FULLSCREEN:
-            if( p_vout && var_GetBool( p_vout, "fullscreen" ) )
+            if( p_vout )
                 var_SetBool( p_vout, "fullscreen", false );
             break;
 
index 5413cc7ff8822b2c33c3b213ca513fe3d81da3a6..326ebadfd5053e2ecf1dee0715d97b558963ecc5 100644 (file)
@@ -82,19 +82,6 @@ static inline int ForwardEvent( vlc_object_t *p_this, char const *psz_var,
 
     return var_Set( p_dst, psz_var, newval );
 }
-/**
- * Internal helper to forward fullscreen event from p_this to p_data.
- */
-static inline int ForwardFullscreen( vlc_object_t *p_this, char const *psz_var,
-                                     vlc_value_t oldval, vlc_value_t newval, void *p_data )
-{
-    VLC_UNUSED(p_this); VLC_UNUSED(oldval);
-    vlc_object_t *p_dst = (vlc_object_t*)p_data;
-
-    if( !var_GetBool( p_dst, "fullscreen" ) != !newval.b_bool )
-        return var_SetBool( p_dst, psz_var, newval.b_bool );
-    return VLC_SUCCESS;
-}
 /**
  * Install/remove all callbacks needed for proper event handling inside
  * a vout-filter.
@@ -129,9 +116,9 @@ static inline void vout_filter_SetupChild( vout_thread_t *p_parent, vout_thread_
 
     /* */
     if( !pf_fullscreen_up )
-        pf_fullscreen_up = ForwardFullscreen;
+        pf_fullscreen_up = ForwardEvent;
     if( !pf_fullscreen_down )
-        pf_fullscreen_down = ForwardFullscreen;
+        pf_fullscreen_down = ForwardEvent;
     pf_execute( VLC_OBJECT(p_child),  "fullscreen", pf_fullscreen_up,   p_parent );
     pf_execute( VLC_OBJECT(p_parent), "fullscreen", pf_fullscreen_down, p_child );
 }
index 9271c9723788b59b18ac327a027349447ce8ef32..26c078a92d81fe47ad0865a8aba15941d33f5a71 100644 (file)
@@ -562,9 +562,7 @@ static int FullscreenEventUp( vlc_object_t *p_this, char const *psz_var,
     VLC_UNUSED(oldval); VLC_UNUSED(p_this); VLC_UNUSED(psz_var); VLC_UNUSED(newval);
 
     const bool b_fullscreen = IsFullscreenActive( p_vout );
-    if( !var_GetBool( p_vout, "fullscreen" ) != !b_fullscreen )
-        return var_SetBool( p_vout, "fullscreen", b_fullscreen );
-    return VLC_SUCCESS;
+    return var_SetBool( p_vout, "fullscreen", b_fullscreen );
 }
 static int FullscreenEventDown( vlc_object_t *p_this, char const *psz_var,
                                 vlc_value_t oldval, vlc_value_t newval, void *p_data )
@@ -573,19 +571,10 @@ static int FullscreenEventDown( vlc_object_t *p_this, char const *psz_var,
     vout_sys_t *p_sys = p_vout->p_sys;
     VLC_UNUSED(oldval); VLC_UNUSED(p_data); VLC_UNUSED(psz_var);
 
-    const bool b_fullscreen = IsFullscreenActive( p_vout );
-    if( !b_fullscreen != !newval.b_bool )
+    for( int i = 0; i < p_sys->i_vout; i++ )
     {
-        for( int i = 0; i < p_sys->i_vout; i++ )
-        {
-            vout_thread_t *p_child = p_sys->pp_vout[i];
-            if( !var_GetBool( p_child, "fullscreen" ) != !newval.b_bool )
-            {
-                var_SetBool( p_child, "fullscreen", newval.b_bool );
-                if( newval.b_bool )
-                    return VLC_SUCCESS;
-            }
-        }
+        vout_thread_t *p_child = p_sys->pp_vout[i];
+        var_SetBool( p_child, "fullscreen", newval.b_bool );
     }
     return VLC_SUCCESS;
 }
index 2ac3b3f0753b5babb96abda62887caca5448635a..6614d5d9584c75c9f2dbec036f88b68337d66fc1 100644 (file)
@@ -100,8 +100,7 @@ static inline void vout_SendEventMouseHidden(vout_thread_t *vout)
 
 static inline void vout_SendEventFullscreen(vout_thread_t *vout, bool is_fullscreen)
 {
-    if (!var_GetBool(vout, "fullscreen") != !is_fullscreen)
-        var_SetBool(vout, "fullscreen", is_fullscreen);
+    var_SetBool(vout, "fullscreen", is_fullscreen);
 }
 
 static inline void vout_SendEventDisplayFilled(vout_thread_t *vout, bool is_display_filled)
index ceaa7e1d848c01761d705edc8479e1e4c6e91cfe..4577b1e57a8a9353e4d554a195a9140441f5d948 100644 (file)
@@ -978,8 +978,10 @@ static int FullscreenCallback( vlc_object_t *p_this, char const *psz_cmd,
 {
     vout_thread_t *p_vout = (vout_thread_t *)p_this;
     vlc_value_t val;
-    (void)psz_cmd; (void)oldval; (void)p_data;
+    (void)psz_cmd; (void)p_data;
 
+    if( oldval.b_bool == newval.b_bool )
+        return VLC_SUCCESS; /* no-op */
     p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
 
     /* Modify libvlc as well because the vout might have to be restarted */