48 lines
2.1 KiB
C
48 lines
2.1 KiB
C
#ifndef FENRIR_TERMINAL_NATIVE_H
|
|
#define FENRIR_TERMINAL_NATIVE_H
|
|
#include <stdint.h>
|
|
#include <termios.h>
|
|
#include <vterm.h>
|
|
|
|
typedef struct TerminalX TerminalX;
|
|
typedef struct {
|
|
int type, keycode, value;
|
|
unsigned int state;
|
|
unsigned long symbol, time;
|
|
char text[128];
|
|
int length;
|
|
} TerminalEvent;
|
|
|
|
int terminal_pty(int *master, int *slave, int rows, int cols);
|
|
int terminal_raw(int fd, struct termios *saved, int *flags);
|
|
int terminal_restore(int fd, struct termios *saved, int flags);
|
|
int terminal_size(int fd, int *rows, int *cols);
|
|
int terminal_resize(int fd, int rows, int cols);
|
|
int terminal_wait(int master, int input, int output, int xfd, int wake, int writing, int output_pending);
|
|
VTerm *terminal_vterm(int rows, int cols);
|
|
void terminal_vterm_free(VTerm *vt);
|
|
uint64_t terminal_generation(VTerm *vt);
|
|
typedef struct { uint32_t foreground, background, style; } TerminalAttribute;
|
|
void terminal_cells(VTerm *vt, uint32_t *cells, TerminalAttribute *attributes, int count, int *x, int *y);
|
|
int terminal_key(VTerm *vt, const TerminalEvent *event, char *bytes, int size);
|
|
TerminalX *terminal_x_open(unsigned long window, int *error);
|
|
int terminal_x_caps_lock(TerminalX *x, int enabled);
|
|
int terminal_x_toggle_caps(TerminalX *x);
|
|
int terminal_x_script_keys(TerminalX *x, const int *keys, int count);
|
|
int terminal_x_update_keys(TerminalX *x, const int *keys, int count);
|
|
void terminal_x_close(TerminalX *x);
|
|
int terminal_x_fd(TerminalX *x);
|
|
int terminal_x_down(TerminalX *x, int code);
|
|
int terminal_x_keys_down(TerminalX *x);
|
|
int terminal_x_pending(TerminalX *x);
|
|
int terminal_x_state(TerminalX *x, int *active, int *numlock, int *capslock);
|
|
int terminal_x_next(TerminalX *x, TerminalEvent *event);
|
|
enum { TERMINAL_CAPTURE_INACTIVE = 5 };
|
|
// Zero means captured; positive values are X grab refusal statuses or
|
|
// TERMINAL_CAPTURE_INACTIVE, distinct from GrabSuccess through GrabFrozen (0..4).
|
|
int terminal_x_consume(TerminalX *x);
|
|
void terminal_x_replay(TerminalX *x, unsigned long time);
|
|
void terminal_x_release(TerminalX *x);
|
|
int terminal_key_code(unsigned long symbol, int keycode);
|
|
#endif
|