Data Structures | Defines | 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

Defines

#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 void vlc_MapAction (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.


Define 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_str2keycode().

#define MAXACTION   20

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_key_to_action(), and vlc_MapAction().

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().

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(), ACTIONS_COUNT, and action::value.

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:
code key code to translate to a string
locale true 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_ALT, KEY_MODIFIER_COMMAND, KEY_MODIFIER_CTRL, KEY_MODIFIER_META, KEY_MODIFIER_SHIFT, N_, name, nooptext(), key_descriptor_s::psz_key_string, utf8_cp(), and vlc_gettext().

static void vlc_MapAction ( vlc_object_t obj,
void **  map,
const char *  confname,
vlc_action_t  action 
) [static]

Sets up all key mappings for a given action.

Parameters:
map tree (of struct mapping entries) to write mappings to
confname VLC configuration item to read mappings from
action action ID

References mapping::action, code, mapping::key, KEY_UNSET, keycmp(), msg_Warn, strtok_r(), tsearch(), unlikely, var_InheritString, and vlc_str2keycode().

Referenced by vlc_InitActions().

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_UNSET, KEYS_COUNT, keystrcmp(), strncasecmp(), and vlc_towc().

Referenced by vlc_MapAction().


Variable Documentation

struct action actions[] [static]
struct key_descriptor_s vlc_keys[] [static]
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines