Blob Blame Raw
#ifndef INPUT_H
#define INPUT_H


#include "common.h"

#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/keysymdef.h>


#define IN_MAXKEYS 256

enum {
  IM_SHIFT,
  IM_CAPSLOCK,
  IM_SHIFTLOCK,
  IM_NUMLOCK,
  IM_GROUP,
  IM_COUNT };


typedef struct Input {
  App *app;
  Display *dpy;
  int key0, key1;
  unsigned int keys[IN_MAXKEYS][1 << IM_COUNT];
  unsigned int masks[IM_COUNT];
  
  int mapKey;
  int mapDown;
  int updated;
} Input;


int inputInit(Input *in, App *app);
void inputDeinit(Input *in);

void inputUpdateLayout(Input *in);
int inputKeycode(Input *in, unsigned int keySym);
void inputEvent(Input *in, int keycode, int press);


#endif