aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/menu/menu.h
blob: f4345bbef4b30c98903b1c920c7cfd71a3616919 (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
/* See LICENSE file for copyright and license details. */
#include <u.h>
#include <base.h>
#include <libutf.h>

#include <time.h>
#include <locale.h>

#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xinerama.h>
#include <X11/Xft/Xft.h>

#include "drw.h"

/* macros */
#define INTERSECT(x,y,w,h,r)  (MAX(0, MIN((x)+(w),(r).x_org+(r).width)  - MAX((x),(r).x_org)) \
                             * MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org)))
#define TEXTW(X)              (drw_fontset_getwidth(drw, (X)) + lrpad)
#define BETWEEN(X, A, B)      ((A) <= (X) && (X) <= (B))


/* enums */
enum { 
    SchemeNorm, 
    SchemeSel, 
    SchemeOut, 
    SchemeLast 
}; /* color schemes */

struct item {
	char *text;
	struct item *left, *right;
	int out;
};

/* util.c */
void  fatal(const char *fmt, ...);
void *ecalloc(size_t nmemb, size_t size);