2008-10-07 00:27:19 +02:00
|
|
|
#ifndef GUARD_TERMKEY_INTERNAL_H_
|
|
|
|
#define GUARD_TERMKEY_INTERNAL_H_
|
|
|
|
|
|
|
|
#include "termkey.h"
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <termios.h>
|
|
|
|
|
|
|
|
struct termkey_driver
|
|
|
|
{
|
2008-10-09 21:23:45 +02:00
|
|
|
void *(*new_driver)(termkey_t *tk, const char *term);
|
2008-10-07 00:36:14 +02:00
|
|
|
void (*free_driver)(void *);
|
2008-10-08 01:44:33 +02:00
|
|
|
termkey_result (*getkey)(termkey_t *tk, termkey_key *key, int force);
|
2008-10-07 00:27:19 +02:00
|
|
|
};
|
|
|
|
|
2008-10-08 01:12:41 +02:00
|
|
|
struct keyinfo {
|
|
|
|
termkey_type type;
|
|
|
|
termkey_keysym sym;
|
|
|
|
int modifier_mask;
|
|
|
|
int modifier_set;
|
|
|
|
};
|
|
|
|
|
2008-10-07 00:27:19 +02:00
|
|
|
struct termkey {
|
|
|
|
int fd;
|
|
|
|
int flags;
|
|
|
|
unsigned char *buffer;
|
|
|
|
size_t buffstart; // First offset in buffer
|
|
|
|
size_t buffcount; // NUMBER of entires valid in buffer
|
|
|
|
size_t buffsize; // Total malloc'ed size
|
|
|
|
|
|
|
|
struct termios restore_termios;
|
|
|
|
char restore_termios_valid;
|
|
|
|
|
|
|
|
int waittime; // msec
|
|
|
|
|
|
|
|
char is_closed;
|
|
|
|
|
|
|
|
int nkeynames;
|
|
|
|
const char **keynames;
|
|
|
|
|
2008-10-08 01:12:41 +02:00
|
|
|
// There are 32 C0 codes
|
|
|
|
struct keyinfo c0[32];
|
|
|
|
|
2008-10-07 00:27:19 +02:00
|
|
|
struct termkey_driver driver;
|
|
|
|
void *driver_info;
|
2008-10-07 23:22:59 +02:00
|
|
|
|
|
|
|
// Now some "protected" methods for the driver to call but which we don't
|
|
|
|
// want exported as real symbols in the library
|
|
|
|
struct {
|
2008-10-08 00:57:01 +02:00
|
|
|
void (*eat_bytes)(termkey_t *tk, size_t count);
|
2008-10-08 01:12:41 +02:00
|
|
|
void (*emit_codepoint)(termkey_t *tk, int codepoint, termkey_key *key);
|
2008-10-08 01:36:27 +02:00
|
|
|
termkey_result (*getkey_simple)(termkey_t *tk, termkey_key *key);
|
2008-10-07 23:22:59 +02:00
|
|
|
} method;
|
2008-10-07 00:27:19 +02:00
|
|
|
};
|
|
|
|
|
2008-10-07 00:36:14 +02:00
|
|
|
extern struct termkey_driver termkey_driver_csi;
|
2008-10-08 03:04:47 +02:00
|
|
|
extern struct termkey_driver termkey_driver_ti;
|
2008-10-07 00:27:19 +02:00
|
|
|
|
|
|
|
#endif
|