#include <pthread.h>
#include <stdint.h>

typedef struct {
  uint8_t key_type : 3;
  union {
    char c;
    struct {
      uint8_t key;
      uint8_t modifier : 4;
    } special;
    struct {
      uint8_t x;
      uint8_t y;
      uint8_t button : 2;
      uint8_t state : 2;
      uint8_t modifier : 2;
    } mouse;
  };
} KeyEvent;

extern pthread_mutex_t screen_mutex;
extern uint8_t mode;
