1 /*****************************************************************************
2 * action.c: key to action mapping
3 *****************************************************************************
4 * Copyright © 2008 Rémi Denis-Courmont
5 * © 2009 Antoine Cellerier
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
26 #include <vlc_common.h>
27 #include "../libvlc.h"
30 int vlc_key_to_action (vlc_object_t *libvlc, const char *varname,
31 vlc_value_t prevkey, vlc_value_t curkey, void *priv)
33 const struct hotkey *key = priv;
38 while (key->i_key != curkey.i_int)
40 if (key->psz_action == NULL)
41 return VLC_SUCCESS; /* key is not mapped to anything */
46 return var_SetInteger (libvlc, "key-action", key->i_action);
49 vlc_key_t vlc_GetActionId(const char *name)
51 for (size_t i = 0; i < libvlc_actions_count; i++)
52 if (!strcmp(libvlc_actions[i].name, name))
53 return libvlc_actions[i].value;