aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
blob: 7174f3824021c5ae5a095d39b26601f8e6d8a629 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* See LICENSE file for copyright and license details. */
#ifndef COMMON_H_
#define COMMON_H_

#include <sys/epoll.h>
#include <locale.h>
#include <termios.h>

#include <libsimple.h>
#include <libsimple-arg.h>
#include <libterminput.h>
#include <libcmap.h>


#define COMMA ,


#define IS_KEY(INPUT, KEY)\
        ((INPUT)->keypress.key == LIBTERMINPUT_SYMBOL &&\
         toupper((INPUT)->keypress.symbol[0]) == toupper((KEY)) &&\
         !(INPUT)->keypress.symbol[1])

#define IS_CTRL_KEY(INPUT, KEY)\
	(((INPUT)->keypress.mods & (enum libterminput_mod)~LIBTERMINPUT_SHIFT) == LIBTERMINPUT_CTRL &&\
	 IS_KEY((INPUT), (KEY)))


#endif