ELinks 0.18.0
kbdbind.h File Reference
#include "config/options.h"
#include "main/event.h"
#include "main/object.h"
#include "terminal/terminal.h"
#include "util/string.h"
#include "config/actions-main.inc"
#include "config/actions-edit.inc"
#include "config/actions-menu.inc"
Include dependency graph for kbdbind.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  action
 
struct  action_list
 
struct  keymap
 
struct  keybinding
 

Macros

#define ACTION_(map, name, action, caption, flags)    ACT_##map##_##action
 
#define add_accesskey_to_string(str, accesskey)
 

Typedefs

typedef long action_id_T
 
typedef long keymap_id_T
 
typedef long main_action_T
 
typedef long edit_action_T
 
typedef unsigned short kbdbind_flags_T
 

Enumerations

enum  keymap_id {
  KEYMAP_INVALID = -1 , KEYMAP_MAIN , KEYMAP_EDIT , KEYMAP_MENU ,
  KEYMAP_MAX
}
 
enum  action_flags {
  ACTION_RESTRICT_ANONYMOUS = (1 << 16) , ACTION_REQUIRE_VIEW_STATE = (1 << 17) , ACTION_REQUIRE_LOCATION = (1 << 18) , ACTION_JUMP_TO_LINK = (1 << 19) ,
  ACTION_REQUIRE_LINK = (1 << 20) , ACTION_REQUIRE_FORM = (1 << 21) , ACTION_FLAGS_MASK = (0xFF << 16)
}
 
enum  main_action { MAIN_ACTIONS }
 
enum  edit_action { EDIT_ACTIONS }
 
enum  menu_action { MENU_ACTIONS }
 
enum  kbdbind_flags { KBDB_WATERMARK = 1 , KBDB_TOUCHED = 2 , KBDB_DEFAULT_KEY = 4 , KBDB_DEFAULT_BINDING = 8 }
 

Functions

struct keybindingadd_keybinding (keymap_id_T keymap_id, action_id_T action_id, struct term_event_keyboard *kbd, int event)
 
int keybinding_exists (keymap_id_T keymap_id, struct term_event_keyboard *kbd, action_id_T *action_id)
 
void free_keybinding (struct keybinding *)
 
const struct actionget_action (keymap_id_T keymap_id, action_id_T action_id)
 
char * get_action_name (keymap_id_T keymap_id, action_id_T action_id)
 
action_id_T get_action_from_string (keymap_id_T keymap_id, const char *str)
 
char * get_action_name_from_keystroke (keymap_id_T keymap_id, const char *keystroke_str)
 
static unsigned int action_is_anonymous_safe (keymap_id_T keymap_id, action_id_T action_id)
 
static unsigned int action_requires_view_state (keymap_id_T keymap_id, action_id_T action_id)
 
static unsigned int action_requires_location (keymap_id_T keymap_id, action_id_T action_id)
 
static unsigned int action_prefix_is_link_number (keymap_id_T keymap_id, action_id_T action_id)
 
static unsigned int action_requires_link (keymap_id_T keymap_id, action_id_T action_id)
 
static unsigned int action_requires_form (keymap_id_T keymap_id, action_id_T action_id)
 
term_event_key_T read_key (const char *)
 
const char * get_keymap_name (keymap_id_T)
 
int parse_keystroke (const char *, struct term_event_keyboard *)
 Parse the string s as the name of a keystroke.
 
void add_keystroke_to_string (struct string *str, struct term_event_keyboard *kbd, int escape)
 
action_id_T kbd_action (keymap_id_T, struct term_event *, int *)
 
struct keybindingkbd_ev_lookup (keymap_id_T, struct term_event_keyboard *kbd, int *)
 
struct keybindingkbd_nm_lookup (keymap_id_T, const char *)
 
int bind_do (const char *, const char *, char *, int)
 
char * bind_act (char *, const char *)
 
void bind_config_string (struct string *)
 
void add_keystroke_action_to_string (struct string *string, action_id_T action_id, keymap_id_T keymap_id)
 
char * get_keystroke (action_id_T action_id, keymap_id_T keymap_id)
 
void add_actions_to_string (struct string *string, action_id_T actions[], keymap_id_T keymap_id, struct terminal *term)
 

Variables

struct module kbdbind_module
 

Macro Definition Documentation

◆ ACTION_

#define ACTION_ ( map,
name,
action,
caption,
flags )    ACT_##map##_##action

◆ add_accesskey_to_string

#define add_accesskey_to_string ( str,
accesskey )
Value:
do { \
struct term_event_keyboard kbd; \
/* FIXME: #ifndef CONFIG_UTF8, kbd.key is encoded in \
* the charset of the terminal, so accesskey should be \
* converted from unicode_val_T to that. \
* #ifdef CONFIG_UTF8, the code is correct. */ \
kbd.key = accesskey; \
/* try_document_key() recognizes only Alt-accesskey \
* combos. */ \
kbd.modifier = KBD_MOD_ALT; \
add_keystroke_to_string(str, &kbd, 0); \
} while (0)
@ KBD_MOD_ALT
Definition kbd.h:44
A key received from a terminal, with modifiers.
Definition kbd.h:56
term_event_key_T key
Definition kbd.h:57

Typedef Documentation

◆ action_id_T

typedef long action_id_T

◆ edit_action_T

typedef long edit_action_T

◆ kbdbind_flags_T

typedef unsigned short kbdbind_flags_T

◆ keymap_id_T

typedef long keymap_id_T

◆ main_action_T

typedef long main_action_T

Enumeration Type Documentation

◆ action_flags

Enumerator
ACTION_RESTRICT_ANONYMOUS 
ACTION_REQUIRE_VIEW_STATE 
ACTION_REQUIRE_LOCATION 
ACTION_JUMP_TO_LINK 
ACTION_REQUIRE_LINK 
ACTION_REQUIRE_FORM 
ACTION_FLAGS_MASK 

◆ edit_action

Enumerator
EDIT_ACTIONS 

◆ kbdbind_flags

Enumerator
KBDB_WATERMARK 
KBDB_TOUCHED 
KBDB_DEFAULT_KEY 
KBDB_DEFAULT_BINDING 

◆ keymap_id

enum keymap_id
Enumerator
KEYMAP_INVALID 
KEYMAP_MAIN 
KEYMAP_EDIT 
KEYMAP_MENU 
KEYMAP_MAX 

◆ main_action

Enumerator
MAIN_ACTIONS 

◆ menu_action

Enumerator
MENU_ACTIONS 

Function Documentation

◆ action_is_anonymous_safe()

static unsigned int action_is_anonymous_safe ( keymap_id_T keymap_id,
action_id_T action_id )
inlinestatic

◆ action_prefix_is_link_number()

static unsigned int action_prefix_is_link_number ( keymap_id_T keymap_id,
action_id_T action_id )
inlinestatic

◆ action_requires_form()

static unsigned int action_requires_form ( keymap_id_T keymap_id,
action_id_T action_id )
inlinestatic

◆ action_requires_link()

static unsigned int action_requires_link ( keymap_id_T keymap_id,
action_id_T action_id )
inlinestatic

◆ action_requires_location()

static unsigned int action_requires_location ( keymap_id_T keymap_id,
action_id_T action_id )
inlinestatic

◆ action_requires_view_state()

static unsigned int action_requires_view_state ( keymap_id_T keymap_id,
action_id_T action_id )
inlinestatic

◆ add_actions_to_string()

void add_actions_to_string ( struct string * string,
action_id_T actions[],
keymap_id_T keymap_id,
struct terminal * term )

◆ add_keybinding()

struct keybinding * add_keybinding ( keymap_id_T keymap_id,
action_id_T action_id,
struct term_event_keyboard * kbd,
int event )

◆ add_keystroke_action_to_string()

void add_keystroke_action_to_string ( struct string * string,
action_id_T action_id,
keymap_id_T keymap_id )

◆ add_keystroke_to_string()

void add_keystroke_to_string ( struct string * str,
struct term_event_keyboard * kbd,
int escape )

◆ bind_act()

char * bind_act ( char * keymap_str,
const char * keystroke_str )

◆ bind_config_string()

void bind_config_string ( struct string * file)

◆ bind_do()

int bind_do ( const char * keymap_str,
const char * keystroke_str,
char * action_str,
int is_system_conf )

◆ free_keybinding()

void free_keybinding ( struct keybinding * keybinding)

◆ get_action()

const struct action * get_action ( keymap_id_T keymap_id,
action_id_T action_id )

◆ get_action_from_string()

action_id_T get_action_from_string ( keymap_id_T keymap_id,
const char * str )

◆ get_action_name()

char * get_action_name ( keymap_id_T keymap_id,
action_id_T action_id )

◆ get_action_name_from_keystroke()

char * get_action_name_from_keystroke ( keymap_id_T keymap_id,
const char * keystroke_str )

◆ get_keymap_name()

const char * get_keymap_name ( keymap_id_T keymap_id)

◆ get_keystroke()

char * get_keystroke ( action_id_T action_id,
keymap_id_T keymap_id )

◆ kbd_action()

action_id_T kbd_action ( keymap_id_T keymap_id,
struct term_event * ev,
int * event )

◆ kbd_ev_lookup()

struct keybinding * kbd_ev_lookup ( keymap_id_T keymap_id,
struct term_event_keyboard * kbd,
int * event )

◆ kbd_nm_lookup()

struct keybinding * kbd_nm_lookup ( keymap_id_T keymap_id,
const char * name )

◆ keybinding_exists()

int keybinding_exists ( keymap_id_T keymap_id,
struct term_event_keyboard * kbd,
action_id_T * action_id )

◆ parse_keystroke()

int parse_keystroke ( const char * s,
struct term_event_keyboard * kbd )

Parse the string s as the name of a keystroke.

Write the parsed key and modifiers to *kbd.

Returns
>=0 on success, <0 on error.

This function does not support KBD_MOD_PASTE, because keystrokes that include it should never be bound to actions.

◆ read_key()

term_event_key_T read_key ( const char * key_str)

Variable Documentation

◆ kbdbind_module

struct module kbdbind_module
extern