Rename key-related APIs:

lookup_key() -> tty_keyname_to_keycode()
  lookup_key_by_code() -> tty_keycode_to_keyname()

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2023-04-15 15:19:05 +03:00
parent ea40129743
commit 6fb8b13207
5 changed files with 10 additions and 10 deletions

View File

@ -438,7 +438,7 @@ keybind_cmd_bind (GArray * keymap, const char *keybind, long action)
char *caption = NULL;
long key;
key = lookup_key (keybind, &caption);
key = tty_keyname_to_keycode (keybind, &caption);
keymap_add (keymap, key, action, caption);
g_free (caption);
}

View File

@ -1451,7 +1451,7 @@ channels_down (void)
*/
long
lookup_key (const char *name, char **label)
tty_keyname_to_keycode (const char *name, char **label)
{
char **lc_keys, **p;
char *cname;
@ -1566,7 +1566,7 @@ lookup_key (const char *name, char **label)
/* --------------------------------------------------------------------------------------------- */
char *
lookup_key_by_code (const int keycode)
tty_keycode_to_keyname (const int keycode)
{
/* code without modifier */
unsigned int k = keycode & ~KEY_M_MASK;

View File

@ -75,8 +75,8 @@ void init_key (void);
void init_key_input_fd (void);
void done_key (void);
long lookup_key (const char *name, char **label);
char *lookup_key_by_code (const int keycode);
long tty_keyname_to_keycode (const char *name, char **label);
char *tty_keycode_to_keyname (const int keycode);
/* mouse support */
int tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block);
gboolean is_idle (void);

View File

@ -26,7 +26,7 @@
#include "lib/global.h"
#include "lib/mcconfig.h"
#include "lib/tty/key.h" /* lookup_key*() */
#include "lib/tty/key.h" /* tty_keyname_to_keycode*() */
#include "lib/keybind.h" /* keybind_lookup_actionname() */
#include "lib/fileloc.h"
@ -122,7 +122,7 @@ edit_delete_macro (WEdit * edit, int hotkey)
if (macros_config == NULL)
return FALSE;
skeyname = lookup_key_by_code (hotkey);
skeyname = tty_keycode_to_keyname (hotkey);
while (mc_config_del_key (macros_config, section_name, skeyname))
;
g_free (skeyname);
@ -171,7 +171,7 @@ edit_store_macro_cmd (WEdit * edit)
edit_push_undo_action (edit, KEY_PRESS + edit->start_display);
skeyname = lookup_key_by_code (hotkey);
skeyname = tty_keycode_to_keyname (hotkey);
for (i = 0; i < macro_index; i++)
{
@ -252,7 +252,7 @@ edit_load_macro_cmd (WEdit * edit)
macros_t macro;
values = mc_config_get_string_list (macros_config, section_name, *profile_keys, NULL);
hotkey = lookup_key (*profile_keys, NULL);
hotkey = tty_keyname_to_keycode (*profile_keys, NULL);
for (curr_values = values; *curr_values != NULL && *curr_values[0] != '\0'; curr_values++)
{

View File

@ -628,7 +628,7 @@ load_keys_from_section (const char *terminal, mc_config_t * cfg)
continue;
}
key_code = lookup_key (*profile_keys, NULL);
key_code = tty_keyname_to_keycode (*profile_keys, NULL);
if (key_code != 0)
{
gchar **values;