[vlc-devel] [PATCH] Patch to rc interface to allow fullscreen on/off forcing.

Greg Farrell greg at gregfarrell.org
Mon Oct 10 09:58:41 CEST 2005


Hi,

   As it stands the fullscreen cmd in the rc interface toggles
fullscreen mode. If you are already fullscreen you will go
non-fullscreen and if you are already non-fullscreen you will go
fullscreen.

If the caller (in my case another app) wants to be sure they go
fullscreen they need to know vlc's current state. There is no way to say
you want to be in fullscreen whatever your current mode is.

So I've written a small patch that adds an optional parameter to the
fullscreen cmd. If it's missing or gibberish then fullscreen will still
toggle as normal. If it's there and arg == "on" then fullscreen mode
will be turned on, or left on if already on. And the opposite for "off".

This is useful for me as my controlling app will no longer need to
duplicate the tracking of fullscreen vlc already does, and also
hopefully for others. It also doesn't change the current behaviour for
anyone who already uses fullscreen as a simple toggle.

Hope you'll accept the below patch.

   Greg


--- vlc-trunk.backup/modules/control/rc.c      2005-10-07
13:38:53.000000000 +0100
+++ modules/control/rc.c        2005-10-07 15:32:27.491257170 +0100
@@ -814,9 +814,21 @@
                 if( p_vout )
                 {
                     vlc_value_t val;
+                    vlc_bool_t b_no_set = VLC_FALSE;
+
                     var_Get( p_vout, "fullscreen", &val );
                     val.b_bool = !val.b_bool;
-                    var_Set( p_vout, "fullscreen", val );
+                    if( strlen( psz_arg ) > 0)
+                    {
+                        /* If it's already in the mode we want, turn on
b_no_set flag */
+                        if ( !strcmp(psz_arg, "on") && val.b_bool ==
VLC_FALSE)
+                            b_no_set = VLC_TRUE;
+                        else if ( !strcmp(psz_arg, "off") && val.b_bool
== VLC_TRUE)
+                            b_no_set = VLC_TRUE;
+                    }
+                    /* Toggle fullscreen unless we're forcing and
already in the correct mode */
+                    if (!b_no_set)
+                        var_Set( p_vout, "fullscreen", val );
                     vlc_object_release( p_vout );
                 }
             }
@@ -888,7 +900,7 @@
     msg_rc(_("| faster . . . . . . . .  faster playing of stream"));
     msg_rc(_("| slower . . . . . . . .  slower playing of stream"));
     msg_rc(_("| normal . . . . . . . .  normal playing of stream"));
-    msg_rc(_("| f  . . . . . . . . . . . . . . toggle fullscreen"));
+    msg_rc(_("| f [on|off] . . . . . . . . . . toggle fullscreen"));
     msg_rc(_("| info . . .  information about the current stream"));
     msg_rc(  "| ");
     msg_rc(_("| volume [X] . . . . . . . .  set/get audio volume"));





-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list