File: keys.h

package info (click to toggle)
epic4 1%3A3.0-2.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,756 kB
  • sloc: ansic: 56,285; makefile: 631; sh: 161; perl: 30
file content (63 lines) | stat: -rw-r--r-- 2,170 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * keys.h: header for keys.c 
 *
 * Copyright 2002 EPIC Software Labs
 * See the COPYRIGHT file, or do a HELP IRCII COPYRIGHT 
 */

#ifndef __keys_h__
#define __keys_h__

/* This is a typedef for a function used with the /BIND system.  The
 * functions all live in input.c.  Following it is a macro to quickly define
 * functions to handle keybindings. */
typedef void (*BindFunction) (char, char *);
#define BUILT_IN_BINDING(x) void x (char key, char *string)

/* This is the structure used to hold binding functions. */
struct Binding {
    struct Binding *next;   /* linked-list stuff. :) */

    char    *name;	    /* the name of this binding */
    BindFunction func;	    /* function to use ... */
    char    *alias;	    /* OR alias to call.  one or the other. */
    char    *filename;	    /* the package which added this binding */
};
extern struct Binding *binding_list; /* list head for keybindings */

struct Binding	*add_binding	(const char *, BindFunction, char *);
void		remove_binding	(char *);
struct Binding *find_binding	(const char *);
void		init_binds	(void);

#define KEYMAP_SIZE 256
struct Key {
    unsigned char val;	/* the key value */
    unsigned char changed; /* set if this binding was changed post-startup */
    struct Binding *bound; /* the function we're bound to. */
    struct Key *map;    /* a map of subkeys (may be NULL) */
    struct Key *owner;	/* the key which contains the map we're in. */
    char    *stuff;     /* 'stuff' associated with our binding */
    char    *filename;  /* the package which added this binding */
};

extern struct Key *head_keymap; /* the head keymap.  the root of the keys.  */

struct Key     *handle_keypress	(struct Key *, struct timeval,
				 unsigned char);
struct Key     *timeout_keypress(struct Key *, struct timeval);

BUILT_IN_COMMAND(bindcmd);
BUILT_IN_COMMAND(rbindcmd);
BUILT_IN_COMMAND(parsekeycmd);

void		init_keys 	(void);
void		init_termkeys 	(void);
void		set_key_interval(const void *);
void		save_bindings 	(FILE *, int);
void		remove_bindings	(void);
void		unload_bindings	(const char *);
void		do_stack_bind	(int, char *);
char *		bindctl		(char *);

#endif /* __keys_h_ */