#ifndef __HANDLE_H__
#define __HANDLE_H__

#ifdef __cplusplus
extern "C" {
#endif

#include "kdefines.h"

/* Prefix keys: */
#define KEYMASK_CTRL	0x200
#define KEYMASK_ALT		0x400
#define KEYMASK_NONE	0x0
#define KEYMASK_BITS	0x1FF /* key bits ... & to separate key from flags */
#define KEYMASK_BASIC	0x7FF /* basic keybits */
/* Extended prefix keys (for key_raw): */
#define KEYMASK_LSHIFT	0x800
#define KEYMASK_RSHIFT	0x1000
#define KEYMASK_LALT	0x2000
#define KEYMASK_RALT	0x4000
#define KEYMASK_LCTRL	0x8000
#define KEYMASK_RCTRL	0x10000
#define KEYMASK_SCROLL	0x20000
#define KEYMASK_NUM		0x40000
#define KEYMASK_CAPS	0x80000
#define KEYMASK_INSERT	0x100000
#define KEYMASK_SYSRQ	0x200000
#define KEYMASK_SCROLLP	0x400000
#define KEYMASK_NUMP	0x800000
#define KEYMASK_CAPSP	0x1000000
/* There's some space for future use */

/* Key functions initialization */
t_bool key_init(void);

/* Key functions shutdown */
t_bool key_shut(void);

/* Keyboard layout switch */
t_bool key_switch(char *name);

/* Is there a key in buffer? */
t_bool key_pressed(void);

/* Read a key - something like 'getxkey' but with key-mapping */
t_key key_read(void);

/* 'raw' access to keys - returns all flags + ascii */
t_raw key_raw(void);

/* key to name - only for 'special' keys (code > 256) */
char *key_to_name(t_key k);

/* Is this key printable? */
t_bool key_isprintable(t_ascii c);

#ifdef __cplusplus
}
#endif

#endif

/* vim: set ts=4 cindent shiftwidth=4 tw=0 : */
