VLC  2.1.0-git
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
keys.c File Reference

This file defines functions and structures for hotkey handling in vlc. More...

Include dependency graph for keys.c:

Data Structures

struct  key_descriptor_s
struct  action
struct  mapping
struct  vlc_actions

Macros

#define KEYS_COUNT   (sizeof(vlc_keys)/sizeof(vlc_keys[0]))
#define MAXACTION   20
#define ACTIONS_COUNT   (sizeof (actions) / sizeof (actions[0]))

Typedefs

typedef struct key_descriptor_s key_descriptor_t

Functions

static int keystrcmp (const void *key, const void *elem)
static char * utf8_cp (uint_fast32_t cp, char *buf)
uint_fast32_t vlc_str2keycode (const char *name)
 Parse a human-readable string representation of a VLC key code.
static char * nooptext (const char *txt)
char * vlc_keycode2str (uint_fast32_t code, bool locale)
 Format a human-readable and unique representation of a VLC key code (including modifiers).
static int keycmp (const void *a, const void *b)
static int vlc_key_to_action (vlc_object_t *obj, const char *varname, vlc_value_t prevkey, vlc_value_t curkey, void *d)
static int vlc_AddMapping (void **map, uint32_t keycode, vlc_action_t action)
 Adds a mapping from a certain key code to a certain action.
static void vlc_InitAction (vlc_object_t *obj, void **map, const char *confname, vlc_action_t action)
 Sets up all key mappings for a given action.
struct vlc_actionsvlc_InitActions (libvlc_int_t *libvlc)
 Initializes the key map from configuration.
void vlc_DeinitActions (libvlc_int_t *libvlc, struct vlc_actions *as)
 Destroys the key map.
static int actcmp (const void *key, const void *ent)
vlc_action_t vlc_GetActionId (const char *name)
 Get the action ID from the action name in the configuration subsystem.

Variables

static struct key_descriptor_s vlc_keys []
static struct action actions []

Detailed Description

This file defines functions and structures for hotkey handling in vlc.

Macro Definition Documentation

#define ACTIONS_COUNT   (sizeof (actions) / sizeof (actions[0]))

Referenced by vlc_GetActionId(), and vlc_InitActions().

#define KEYS_COUNT   (sizeof(vlc_keys)/sizeof(vlc_keys[0]))

Referenced by vlc_keycode2str(), and vlc_str2keycode().

#define MAXACTION   20

Referenced by vlc_InitActions().

Typedef Documentation

Function Documentation

static int actcmp ( const void *  key,
const void *  ent 
)
static

References action::name.

Referenced by vlc_GetActionId().

static int keycmp ( const void *  a,
const void *  b 
)
static

References mapping::key.

Referenced by vlc_AddMapping(), and vlc_key_to_action().

static int keystrcmp ( const void *  key,
const void *  elem 
)
static

Referenced by vlc_str2keycode().

static char* nooptext ( const char *  txt)
static

Referenced by vlc_keycode2str().

static char* utf8_cp ( uint_fast32_t  cp,
char *  buf 
)
static

Referenced by vlc_keycode2str().

static int vlc_AddMapping ( void **  map,
uint32_t  keycode,
vlc_action_t  action 
)
static

Adds a mapping from a certain key code to a certain action.

References mapping::action, mapping::key, keycmp(), tsearch(), and unlikely.

Referenced by vlc_InitAction(), and vlc_InitActions().

void vlc_DeinitActions ( libvlc_int_t libvlc,
struct vlc_actions as 
)
vlc_action_t vlc_GetActionId ( const char *  name)

Get the action ID from the action name in the configuration subsystem.

Returns
the action ID or ACTIONID_NONE on error.

References actcmp(), ACTIONID_NONE, ACTIONS_COUNT, and action::value.

static void vlc_InitAction ( vlc_object_t obj,
void **  map,
const char *  confname,
vlc_action_t  action 
)
static

Sets up all key mappings for a given action.

Parameters
maptree (of struct mapping entries) to write mappings to
confnameVLC configuration item to read mappings from
actionaction ID

References code, mapping::key, KEY_UNSET, msg_Warn, strtok_r(), var_InheritString, vlc_AddMapping(), and vlc_str2keycode().

Referenced by vlc_InitActions().

struct vlc_actions* vlc_InitActions ( libvlc_int_t libvlc)
read
static int vlc_key_to_action ( vlc_object_t obj,
const char *  varname,
vlc_value_t  prevkey,
vlc_value_t  curkey,
void *  d 
)
static
char* vlc_keycode2str ( uint_fast32_t  code,
bool  locale 
)

Format a human-readable and unique representation of a VLC key code (including modifiers).

Parameters
codekey code to translate to a string
localetrue to get a localized string, false to get a C string suitable for 'vlcrc'
Returns
a heap-allocated string, or NULL on error.

References asprintf(), key_descriptor_s::i_key_code, KEY_MODIFIER, KEY_MODIFIER_ALT, KEY_MODIFIER_COMMAND, KEY_MODIFIER_CTRL, KEY_MODIFIER_META, KEY_MODIFIER_SHIFT, KEYS_COUNT, N_, name, nooptext(), key_descriptor_s::psz_key_string, utf8_cp(), and vlc_gettext().

uint_fast32_t vlc_str2keycode ( const char *  name)

Parse a human-readable string representation of a VLC key code.

Note
This only works with the American English representation (a.k.a. C or POSIX), not with the local representation returned from vlc_keycode2str().
Returns
a VLC key code, or KEY_UNSET on failure.

References code, key_descriptor_s::i_key_code, KEY_MODIFIER_ALT, KEY_MODIFIER_COMMAND, KEY_MODIFIER_CTRL, KEY_MODIFIER_META, KEY_MODIFIER_SHIFT, KEY_UNSET, KEYS_COUNT, keystrcmp(), and vlc_towc().

Referenced by vlc_InitAction().

Variable Documentation

struct action actions[]
static
struct key_descriptor_s vlc_keys[]
static