- var_Create( p_libvlc, "key-pressed", VLC_VAR_INTEGER );
- var_Create( p_libvlc, "key-action", VLC_VAR_INTEGER );
- {
- struct hotkey *p_keys =
- malloc( (libvlc_actions_count + 1) * sizeof (*p_keys) );
-
- /* Initialize from configuration */
- for( size_t i = 0; i < libvlc_actions_count; i++ )
- {
- p_keys[i].psz_action = libvlc_actions[i].name;
- p_keys[i].i_key = config_GetInt( p_libvlc,
- libvlc_actions[i].name );
- p_keys[i].i_action = libvlc_actions[i].value;
-#ifndef NDEBUG
- if (i > 0
- && strcmp(libvlc_actions[i-1].name, libvlc_actions[i].name) >= 0)
- {
- msg_Err(p_libvlc, "%s and %s are not ordered properly",
- libvlc_actions[i-1].name, libvlc_actions[i].name);
- abort();
- }
-#endif
- }
- p_keys[libvlc_actions_count].psz_action = NULL;
- p_keys[libvlc_actions_count].i_key = 0;
- p_keys[libvlc_actions_count].i_action = 0;
- p_libvlc->p_hotkeys = p_keys;
- var_AddCallback( p_libvlc, "key-pressed", vlc_key_to_action,
- p_keys );
- }