VLC 4.0.0-dev
|
This file defines functions and structures for hotkey handling in vlc. More...
Data Structures | |
struct | key_descriptor |
struct | name2action |
struct | mapping |
struct | vlc_actions_t |
Macros | |
#define | MAXACTION 27 |
#define | STRINGIFY_(x) #x |
#define | STRINGIFY(x) STRINGIFY_(x) |
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 const 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 | add_mapping (void **map, uint32_t keycode, vlc_action_id_t action) |
Adds a mapping from a certain key code to a certain action. | |
static void | add_wheel_mapping (void **map, uint32_t kmore, uint32_t kless, int mode) |
static void | init_action (vlc_object_t *obj, void **map, const char *confname, vlc_action_id_t action) |
Sets up all key mappings for a given action. | |
int | libvlc_InternalActionsInit (libvlc_int_t *libvlc) |
Initializes the key map from configuration. | |
void | libvlc_InternalActionsClean (libvlc_int_t *libvlc) |
Destroys the key map. | |
static int | actcmp (const void *key, const void *ent) |
vlc_action_id_t | vlc_actions_get_id (const char *name) |
Get the action ID from the action name in the configuration subsystem. | |
size_t | vlc_actions_get_keycodes (vlc_object_t *p_obj, const char *psz_key_name, bool b_global, uint_fast32_t **pp_keycodes) |
Get keycodes from a action key name and vlc configuration. | |
const char *const * | vlc_actions_get_key_names (vlc_object_t *p_obj) |
Get a list a key names. | |
Variables | |
static const struct key_descriptor | s_keys [] |
static const struct name2action | s_names2actions [] |
This file defines functions and structures for hotkey handling in vlc.
#define MAXACTION 27 |
#define STRINGIFY | ( | x | ) | STRINGIFY_(x) |
#define STRINGIFY_ | ( | x | ) | #x |
|
static |
References name2action::psz.
Referenced by vlc_actions_get_id().
|
static |
Adds a mapping from a certain key code to a certain action.
References mapping::action, keycmp(), tsearch(), and unlikely.
Referenced by add_wheel_mapping(), and init_action().
|
static |
|
static |
Sets up all key mappings for a given action.
obj | the VLC object to inherit keys from and log to |
map | tree (of struct mapping entries) to write mappings to |
confname | VLC configuration item to read mappings from |
action | action ID |
References mapping::action, add_mapping(), mapping::key, KEY_UNSET, msg_Warn, strtok_r(), var_InheritString(), and vlc_str2keycode().
Referenced by libvlc_InternalActionsInit().
|
static |
References mapping::key.
Referenced by add_mapping(), and vlc_key_to_action().
|
static |
Referenced by vlc_str2keycode().
void libvlc_InternalActionsClean | ( | libvlc_int_t * | libvlc | ) |
Destroys the key map.
References libvlc_priv_t::actions, vlc_actions_t::global_map, libvlc_priv(), vlc_actions_t::map, tdestroy(), unlikely, var_DelCallback(), and vlc_key_to_action().
Referenced by libvlc_InternalCleanup().
int libvlc_InternalActionsInit | ( | libvlc_int_t * | libvlc | ) |
Initializes the key map from configuration.
References libvlc_priv_t::actions, add_wheel_mapping(), ARRAY_SIZE, vlc_actions_t::global_map, name2action::id, init_action(), KEY_MOUSEWHEELDOWN, KEY_MOUSEWHEELLEFT, KEY_MOUSEWHEELRIGHT, KEY_MOUSEWHEELUP, libvlc_priv(), vlc_actions_t::map, MAXACTION, msg_Err, name, vlc_actions_t::ppsz_keys, name2action::psz, s_names2actions, STRINGIFY, unlikely, var_AddCallback(), var_Create(), var_InheritInteger(), VLC_ENOMEM, vlc_key_to_action(), VLC_OBJECT, VLC_SUCCESS, and VLC_VAR_INTEGER.
Referenced by libvlc_InternalInit().
|
static |
Referenced by vlc_keycode2str().
|
static |
Referenced by vlc_keycode2str().
vlc_action_id_t vlc_actions_get_id | ( | const char * | name | ) |
Get the action ID from the action name in the configuration subsystem.
Get the action ID from an action key name.
References actcmp(), ACTIONID_NONE, ARRAY_SIZE, name2action::id, name, and s_names2actions.
const char *const * vlc_actions_get_key_names | ( | vlc_object_t * | p_obj | ) |
Get a list a key names.
References libvlc_priv_t::actions, libvlc_priv(), vlc_actions_t::ppsz_keys, and vlc_object_instance.
size_t vlc_actions_get_keycodes | ( | vlc_object_t * | p_obj, |
const char * | psz_key_name, | ||
bool | b_global, | ||
uint_fast32_t ** | pp_keycodes | ||
) |
Get keycodes from a action key name and vlc configuration.
References ARRAY_SIZE, MAXACTION, strtok_r(), unlikely, var_InheritString(), vlc_alloc(), and vlc_str2keycode().
|
static |
References mapping::action, vlc_value_t::i_int, keycmp(), tfind(), var_SetInteger(), and VLC_SUCCESS.
Referenced by libvlc_InternalActionsClean(), and libvlc_InternalActionsInit().
char * vlc_keycode2str | ( | uint_fast32_t | code, |
bool | locale | ||
) |
Format a human-readable and unique representation of a VLC key code (including modifiers).
code | key code to translate to a string |
locale | true to get a localized string, false to get a C string suitable for 'vlcrc' |
References ARRAY_SIZE, asprintf(), key_descriptor::i_code, KEY_MODIFIER_ALT, KEY_MODIFIER_COMMAND, KEY_MODIFIER_CTRL, KEY_MODIFIER_META, KEY_MODIFIER_SHIFT, N_, name, nooptext(), key_descriptor::psz, s_keys, utf8_cp(), and vlc_gettext().
uint_fast32_t vlc_str2keycode | ( | const char * | name | ) |
Parse a human-readable string representation of a VLC key code.
References ARRAY_SIZE, key_descriptor::i_code, KEY_MODIFIER_ALT, KEY_MODIFIER_COMMAND, KEY_MODIFIER_CTRL, KEY_MODIFIER_META, KEY_MODIFIER_SHIFT, KEY_UNSET, keystrcmp(), name, s_keys, and vlc_towc().
Referenced by init_action(), and vlc_actions_get_keycodes().
|
static |
Referenced by vlc_keycode2str(), and vlc_str2keycode().
|
static |
Referenced by libvlc_InternalActionsInit(), and vlc_actions_get_id().