dmenu

Simple dynamic menu for X
git clone https://git.sinitax.com/suckless/dmenu
Log | Files | Refs | README | LICENSE | sfeed.txt

drw.h (1744B)


      1/* See LICENSE file for copyright and license details. */
      2
      3typedef struct {
      4	Cursor cursor;
      5} Cur;
      6
      7typedef struct Fnt {
      8	Display *dpy;
      9	unsigned int h;
     10	XftFont *xfont;
     11	FcPattern *pattern;
     12	struct Fnt *next;
     13} Fnt;
     14
     15enum { ColFg, ColBg }; /* Clr scheme index */
     16typedef XftColor Clr;
     17
     18typedef struct {
     19	unsigned int w, h;
     20	Display *dpy;
     21	int screen;
     22	Window root;
     23	Drawable drawable;
     24	GC gc;
     25	Clr *scheme;
     26	Fnt *fonts;
     27} Drw;
     28
     29/* Drawable abstraction */
     30Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
     31void drw_resize(Drw *drw, unsigned int w, unsigned int h);
     32void drw_free(Drw *drw);
     33
     34/* Fnt abstraction */
     35Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
     36void drw_fontset_free(Fnt* set);
     37unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
     38unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n);
     39void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
     40
     41/* Colorscheme abstraction */
     42void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
     43Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
     44
     45/* Cursor abstraction */
     46Cur *drw_cur_create(Drw *drw, int shape);
     47void drw_cur_free(Drw *drw, Cur *cursor);
     48
     49/* Drawing context manipulation */
     50void drw_setfontset(Drw *drw, Fnt *set);
     51void drw_setscheme(Drw *drw, Clr *scm);
     52
     53/* Drawing functions */
     54void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
     55int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert);
     56
     57/* Map functions */
     58void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);