| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -57,6 +57,8 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#define TAGMASK                 ((1 << LENGTH(tags)) - 1) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#define TEXTW(X)                (drw_fontset_getwidth(drw, (X)) + lrpad) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#define OPAQUE                  0xffU | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/* enums */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					enum { SchemeNorm, SchemeSel }; /* color schemes */ | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -235,6 +237,7 @@ static Monitor *wintomon(Window w); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					static int xerror(Display *dpy, XErrorEvent *ee); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					static int xerrordummy(Display *dpy, XErrorEvent *ee); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					static int xerrorstart(Display *dpy, XErrorEvent *ee); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					static void xinitvisual(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					static void zoom(const Arg *arg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/* variables */ | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -271,6 +274,11 @@ static Drw *drw; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					static Monitor *mons, *selmon; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					static Window root, wmcheckwin; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					static int useargb = 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					static Visual *visual; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					static int depth; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					static Colormap cmap; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/* configuration, allows nested code to access above variables */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#include "config.h" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1555,7 +1563,8 @@ setup(void) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						sw = DisplayWidth(dpy, screen); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						sh = DisplayHeight(dpy, screen); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						root = RootWindow(dpy, screen); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						drw = drw_create(dpy, screen, root, sw, sh); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						xinitvisual(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						drw = drw_create(dpy, screen, root, sw, sh, visual, depth, cmap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							die("no fonts could be loaded."); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						lrpad = drw->fonts->h; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1583,7 +1592,7 @@ setup(void) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						/* init appearance */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						for (i = 0; i < LENGTH(colors); i++) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							scheme[i] = drw_scm_create(drw, colors[i], 3); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						/* init bars */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						updatebars(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						updatestatus(); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1820,16 +1829,18 @@ updatebars(void) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						Monitor *m; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						XSetWindowAttributes wa = { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							.override_redirect = True, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							.background_pixmap = ParentRelative, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							.background_pixel = 0, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							.border_pixel = 0, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							.colormap = cmap, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							.event_mask = ButtonPressMask|ExposureMask | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						XClassHint ch = {"dwm", "dwm"}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						for (m = mons; m; m = m->next) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (m->barwin) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									CopyFromParent, DefaultVisual(dpy, screen), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, depth, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							                          InputOutput, visual, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							                          CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							XMapRaised(dpy, m->barwin); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							XSetClassHint(dpy, m->barwin, &ch); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -2126,6 +2137,43 @@ xerrorstart(Display *dpy, XErrorEvent *ee) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						return -1; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					void | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					xinitvisual() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						XVisualInfo *infos; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						XRenderPictFormat *fmt; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						int nitems; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						int i; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						XVisualInfo tpl = { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							.screen = screen, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							.depth = 32, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							.class = TrueColor | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						long masks = VisualScreenMask | VisualDepthMask | VisualClassMask; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						infos = XGetVisualInfo(dpy, masks, &tpl, &nitems); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						visual = NULL; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						for(i = 0; i < nitems; i ++) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							fmt = XRenderFindVisualFormat(dpy, infos[i].visual); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								visual = infos[i].visual; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								depth = infos[i].depth; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								cmap = XCreateColormap(dpy, root, visual, AllocNone); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								useargb = 1; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						XFree(infos); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						if (! visual) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							visual = DefaultVisual(dpy, screen); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							depth = DefaultDepth(dpy, screen); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							cmap = DefaultColormap(dpy, screen); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					void | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					zoom(const Arg *arg) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					{ | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |