Dillo v3.1.1-119-g140d9ebd
Loading...
Searching...
No Matches
Keys Class Reference

#include <keys.hh>

Static Public Member Functions

static void init ()
 Initialize the bindings list.
 
static void free ()
 Free data.
 
static void parse (FILE *fp)
 Parse the keysrc.
 
static KeysCommand_t getKeyCmd (void)
 Look if the just pressed key is bound to a command.
 
static int getShortcut (KeysCommand_t cmd)
 Given a keys command, return a shortcut for it, or 0 if there is none (e.g., for KEYS_NEW_WINDOW, return CTRL+'n').
 

Static Private Member Functions

static int nodeByKeyCmp (const void *node, const void *key)
 Compare function by {key,modifier} pairs.
 
static void delKeyCmd (int key, int mod)
 Remove a key binding from the table.
 
static KeysCommand_t getCmdCode (const char *symbolName)
 Takes a command name and searches it in the mapping table.
 
static int getKeyCode (char *keyName)
 Takes a key name and looks it up in the mapping table.
 
static int getModifier (char *modifierName)
 Takes a modifier name and looks it up in the mapping table.
 
static void parseKey (char *key, char *symbol)
 Parse a key-combination/command-name pair, and insert it into the bindings list.
 

Detailed Description

Definition at line 57 of file keys.hh.

Member Function Documentation

◆ delKeyCmd()

void Keys::delKeyCmd ( int  key,
int  mod 
)
staticprivate

Remove a key binding from the table.

Definition at line 232 of file keys.cc.

References bindings, dFree(), dList_find_sorted(), dList_remove(), and nodeByKeyCmp().

Referenced by parseKey().

◆ free()

void Keys::free ( )
static

Free data.

Definition at line 174 of file keys.cc.

References bindings, dFree(), dList_free(), dList_nth_data(), and dList_remove_fast().

Referenced by main().

◆ getCmdCode()

KeysCommand_t Keys::getCmdCode ( const char *  commandName)
staticprivate

Takes a command name and searches it in the mapping table.

Return value: command code if found, -1 otherwise

Definition at line 267 of file keys.cc.

References default_keys, dStrAsciiCasecmp(), and KEYS_INVALID.

Referenced by parseKey().

◆ getKeyCmd()

KeysCommand_t Keys::getKeyCmd ( void  )
static

Look if the just pressed key is bound to a command.

Return value: The command if found, KEYS_NOP otherwise.

Definition at line 200 of file keys.cc.

References _MSG, a_Utf8_decode(), bindings, dList_find_sorted(), KEYS_NOP, and nodeByKeyCmp().

Referenced by UI::handle().

◆ getKeyCode()

int Keys::getKeyCode ( char *  keyName)
staticprivate

Takes a key name and looks it up in the mapping table.

If found, its key code is returned. Otherwise -1 is given back.

Definition at line 251 of file keys.cc.

References dStrAsciiCasecmp(), and keyNames.

Referenced by parseKey().

◆ getModifier()

int Keys::getModifier ( char *  modifierName)
staticprivate

Takes a modifier name and looks it up in the mapping table.

If found, its key code is returned. Otherwise -1 is given back.

Definition at line 282 of file keys.cc.

References dStrAsciiCasecmp(), and modifierNames.

Referenced by parseKey().

◆ getShortcut()

int Keys::getShortcut ( KeysCommand_t  cmd)
static

Given a keys command, return a shortcut for it, or 0 if there is none (e.g., for KEYS_NEW_WINDOW, return CTRL+'n').

Definition at line 298 of file keys.cc.

References bindings, dList_length(), and dList_nth_data().

Referenced by a_Menu_file_popup().

◆ init()

void Keys::init ( )
static

Initialize the bindings list.

Definition at line 153 of file keys.cc.

References bindings, default_keys, dList_insert_sorted(), dList_new(), dNew, dStrdup(), and nodeByKeyCmp().

Referenced by main().

◆ nodeByKeyCmp()

int Keys::nodeByKeyCmp ( const void *  node,
const void *  key 
)
staticprivate

Compare function by {key,modifier} pairs.

Definition at line 189 of file keys.cc.

References _MSG.

Referenced by delKeyCmd(), getKeyCmd(), init(), and parseKey().

◆ parse()

void Keys::parse ( FILE *  fp)
static

Parse the keysrc.

Definition at line 379 of file keys.cc.

References _MSG, dFree(), dGetline(), dParser_parse_rc_line(), MSG, and parseKey().

Referenced by main().

◆ parseKey()

void Keys::parseKey ( char *  key,
char *  symbol 
)
staticprivate

Parse a key-combination/command-name pair, and insert it into the bindings list.

Definition at line 314 of file keys.cc.

References _MSG, a_Utf8_char_count(), a_Utf8_decode(), bindings, delKeyCmd(), dFree(), dList_insert_sorted(), dNew, dStrdup(), dStrndup(), getCmdCode(), getKeyCode(), getModifier(), KEYS_INVALID, KEYS_NOP, MSG, and nodeByKeyCmp().

Referenced by parse().


The documentation for this class was generated from the following files: