X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=dmenu.h;h=4cc13f4635cddbe2b7d4c4d0ae781f4b8b4a074c;hb=855a56631916bdff1438e11c232b88450f973648;hp=8d630baaac260889d884ebf1f7bbcee0c492dc3d;hpb=7817523a685f0dbba2e074a448099558a54b1b9c;p=dmenu.git diff --git a/dmenu.h b/dmenu.h index 8d630ba..4cc13f4 100644 --- a/dmenu.h +++ b/dmenu.h @@ -1,58 +1,30 @@ -/* - * (C)opyright MMVI Anselm R. Garbe - * See LICENSE file for license details. - */ - -#include "config.h" #include -#include - -typedef struct Brush Brush; -typedef struct DC DC; -typedef struct Fnt Fnt; - -struct Fnt { - XFontStruct *xfont; - XFontSet set; - int ascent; - int descent; - int height; -}; - -struct DC { /* draw context */ - int x, y, w, h; - unsigned long bg; - unsigned long fg; - unsigned long border; - Drawable drawable; - Fnt font; - GC gc; -}; - -struct Brush { - GC gc; - Drawable drawable; - int x, y, w, h; - Fnt font; - unsigned long bg; - unsigned long fg; - unsigned long border; -}; - - - -/* draw.c */ -extern void draw(Display *dpy, Brush *b, Bool border, const char *text); -extern void loadcolors(Display *dpy, int screen, Brush *b, - const char *bg, const char *fg, const char *bo); -extern void loadfont(Display *dpy, Fnt *font, const char *fontstr); -extern unsigned int textnw(Fnt *font, char *text, unsigned int len); -extern unsigned int textw(Fnt *font, char *text); -extern unsigned int texth(Fnt *font); +#include +#include "config.h" -/* util.c */ -extern void *emalloc(unsigned int size); -extern void *emallocz(unsigned int size); -extern void eprint(const char *errstr, ...); -extern char *estrdup(const char *str); -extern void swap(void **p1, void **p2); +/* macros */ +#define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define IS_UTF8_1ST_CHAR(c) ((((c) & 0xc0) == 0xc0) || !((c) & 0x80)) + +/* forward declarations */ +void drawbar(void); +void grabkeyboard(void); +void kpress(XKeyEvent *e); +void run(void); +void setup(unsigned int lines); + +/* variables */ +extern char *prompt; +extern char text[4096]; +extern int promptw; +extern int screen; +extern unsigned int numlockmask; +extern unsigned int mw, mh; +extern unsigned long normcol[ColLast]; +extern unsigned long selcol[ColLast]; +extern Bool topbar; +extern DC dc; +extern Display *dpy; +extern Window win, root;