[vlc-commits] cli: remove special case for "key" and "hotkey"

Rémi Denis-Courmont git at videolan.org
Sat Oct 17 20:35:57 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 17 15:33:19 2020 +0300| [92afea6112aa24428836153a5bfb560b33e43f85] | committer: Rémi Denis-Courmont

cli: remove special case for "key" and "hotkey"

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

 modules/control/cli/cli.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/modules/control/cli/cli.c b/modules/control/cli/cli.c
index 839b990a77..1453890bea 100644
--- a/modules/control/cli/cli.c
+++ b/modules/control/cli/cli.c
@@ -172,6 +172,14 @@ static void LogOut(intf_thread_t *intf)
     }
 }
 
+static void KeyAction(intf_thread_t *intf, const char *const *args, size_t n)
+{
+    vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(intf));
+
+    if (n > 1)
+        var_SetInteger(vlc, "key-action", vlc_actions_get_id(args[1]));
+}
+
 static const struct
 {
     const char *name;
@@ -245,6 +253,10 @@ static const struct
     { "voldown", VolumeMove },
     { "adev", AudioDevice },
     { "achan", AudioChannel },
+
+    { "key", KeyAction },
+    { "hotkey", KeyAction },
+
 };
 
 static void Process(intf_thread_t *intf, const char *line)
@@ -283,12 +295,6 @@ static void Process(intf_thread_t *intf, const char *line)
         }
 
     /* misc menu commands */
-    if (strcmp(cmd, "key") == 0 || strcmp(cmd, "hotkey") == 0)
-    {
-       vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(intf));
-       var_SetInteger(vlc, "key-action", vlc_actions_get_id(arg));
-    }
-    else
         switch (cmd[0])
         {
             case 'f':



More information about the vlc-commits mailing list