keyboards - shabble/irssi-docs GitHub Wiki

How the keyboard system works

  • 2 main files
  • gui-readline.c
  • keyboard.c

structures are:

  • KEYBOARD_REC
  • KEYINFO_REC
    • id, description, list of keys and default keys.
  • KEY_REC
    • ptr to KEYINFO, key (str), data (str)

keyboard.c

  • init() initialises the keys/defaultkeys hashes

  • key_bind() takes id (multi, command, nothing, ...), desc, default, data, and callback

  • it checks if the id already exists in keyinfos, otherwise creates and adds it.

  • it adds a signal 'key $id", with the callback as handler.

  • emits keyinfo created.

  • if it already has a keyinfo, it adds it to both default_keys and keys maps.