dwm

Kris's build of dwm
git clone git clone https://git.krisyotam.com/krisyotam/dwm.git
Log | Files | Refs | README | LICENSE

drw.h (3068B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 #if BAR_PANGO_PATCH
      4 #include <pango/pango.h>
      5 #include <pango/pangoxft.h>
      6 #endif // BAR_PANGO_PATCH
      7 
      8 typedef struct {
      9 	Cursor cursor;
     10 } Cur;
     11 
     12 typedef struct Fnt {
     13 	Display *dpy;
     14 	unsigned int h;
     15 	#if BAR_PANGO_PATCH
     16 	PangoLayout *layout;
     17 	#else
     18 	XftFont *xfont;
     19 	FcPattern *pattern;
     20 	struct Fnt *next;
     21 	#endif // BAR_PANGO_PATCH
     22 } Fnt;
     23 
     24 enum { ColFg, ColBg, ColBorder, ColFloat, ColCount }; /* Clr scheme index */
     25 typedef XftColor Clr;
     26 
     27 typedef struct {
     28 	unsigned int w, h;
     29 	Display *dpy;
     30 	int screen;
     31 	Window root;
     32 	#if BAR_ALPHA_PATCH
     33 	Visual *visual;
     34 	unsigned int depth;
     35 	Colormap cmap;
     36 	#endif // BAR_ALPHA_PATCH
     37 	Drawable drawable;
     38 	#if BAR_WINICON_PATCH
     39 	Picture picture;
     40 	#endif // BAR_WINICON_PATCH
     41 	GC gc;
     42 	Clr *scheme;
     43 	Fnt *fonts;
     44 } Drw;
     45 
     46 /* Drawable abstraction */
     47 #if BAR_ALPHA_PATCH
     48 Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
     49 #else
     50 Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
     51 #endif // BAR_ALPHA_PATCH
     52 void drw_resize(Drw *drw, unsigned int w, unsigned int h);
     53 void drw_free(Drw *drw);
     54 
     55 /* Fnt abstraction */
     56 #if BAR_PANGO_PATCH
     57 Fnt *drw_font_create(Drw* drw, const char font[]);
     58 void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup);
     59 #else
     60 Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
     61 void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
     62 #endif // BAR_PANGO_PATCH
     63 void drw_fontset_free(Fnt* set);
     64 unsigned int drw_fontset_getwidth(Drw *drw, const char *text, Bool markup);
     65 
     66 /* Colorscheme abstraction */
     67 void drw_clr_create(
     68 	Drw *drw,
     69 	Clr *dest,
     70 	const char *clrname
     71 	#if BAR_ALPHA_PATCH
     72 	, unsigned int alpha
     73 	#endif // BAR_ALPHA_PATCH
     74 );
     75 Clr *drw_scm_create(
     76 	Drw *drw,
     77 	char *clrnames[],
     78 	#if BAR_ALPHA_PATCH
     79 	const unsigned int alphas[],
     80 	#endif // BAR_ALPHA_PATCH
     81 	size_t clrcount
     82 );
     83 
     84 /* Cursor abstraction */
     85 Cur *drw_cur_create(Drw *drw, int shape);
     86 void drw_cur_free(Drw *drw, Cur *cursor);
     87 
     88 /* Drawing context manipulation */
     89 #if !BAR_PANGO_PATCH
     90 void drw_setfontset(Drw *drw, Fnt *set);
     91 #endif // BAR_PANGO_PATCH
     92 void drw_setscheme(Drw *drw, Clr *scm);
     93 #if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
     94 void drw_settrans(Drw *drw, Clr *psc, Clr *nsc);
     95 #endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
     96 
     97 /* Drawing functions */
     98 void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
     99 int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup);
    100 #if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
    101 void drw_arrow(Drw *drw, int x, int y, unsigned int w, unsigned int h, int direction, int slash);
    102 #endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
    103 
    104 /* Map functions */
    105 void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
    106