sanitized other stuff
							parent
							
								
									adaa28a6e6
								
							
						
					
					
						commit
						c09bf8da07
					
				
							
								
								
									
										4
									
								
								client.c
								
								
								
								
							
							
						
						
									
										4
									
								
								client.c
								
								
								
								
							| 
						 | 
					@ -178,7 +178,7 @@ killclient(Arg *arg)
 | 
				
			||||||
	if(!sel)
 | 
						if(!sel)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	if(sel->proto & WM_PROTOCOL_DELWIN)
 | 
						if(sel->proto & WM_PROTOCOL_DELWIN)
 | 
				
			||||||
		sendevent(sel->win, wm_atom[WMProtocols], wm_atom[WMDelete]);
 | 
							sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		XKillClient(dpy, sel->win);
 | 
							XKillClient(dpy, sel->win);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -353,7 +353,7 @@ settitle(Client *c)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	name.nitems = 0;
 | 
						name.nitems = 0;
 | 
				
			||||||
	c->name[0] = 0;
 | 
						c->name[0] = 0;
 | 
				
			||||||
	XGetTextProperty(dpy, c->win, &name, net_atom[NetWMName]);
 | 
						XGetTextProperty(dpy, c->win, &name, netatom[NetWMName]);
 | 
				
			||||||
	if(!name.nitems)
 | 
						if(!name.nitems)
 | 
				
			||||||
		XGetWMName(dpy, c->win, &name);
 | 
							XGetWMName(dpy, c->win, &name);
 | 
				
			||||||
	if(!name.nitems)
 | 
						if(!name.nitems)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										106
									
								
								draw.c
								
								
								
								
							
							
						
						
									
										106
									
								
								draw.c
								
								
								
								
							| 
						 | 
					@ -29,51 +29,18 @@ drawborder(void)
 | 
				
			||||||
	XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
 | 
						XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* extern functions */
 | 
					static unsigned int
 | 
				
			||||||
 | 
					textnw(char *text, unsigned int len)
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
drawall()
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Client *c;
 | 
						XRectangle r;
 | 
				
			||||||
 | 
						if(dc.font.set) {
 | 
				
			||||||
	for(c = clients; c; c = getnext(c->next))
 | 
							XmbTextExtents(dc.font.set, text, len, NULL, &r);
 | 
				
			||||||
		drawtitle(c);
 | 
							return r.width;
 | 
				
			||||||
	drawstatus();
 | 
						}
 | 
				
			||||||
 | 
						return XTextWidth(dc.font.xfont, text, len);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					static void
 | 
				
			||||||
drawstatus()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	int i;
 | 
					 | 
				
			||||||
	Bool istile = arrange == dotile;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	dc.x = dc.y = 0;
 | 
					 | 
				
			||||||
	dc.w = bw;
 | 
					 | 
				
			||||||
	drawtext(NULL, !istile, False);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	dc.w = 0;
 | 
					 | 
				
			||||||
	for(i = 0; i < TLast; i++) {
 | 
					 | 
				
			||||||
		dc.x += dc.w;
 | 
					 | 
				
			||||||
		dc.w = textw(tags[i]);
 | 
					 | 
				
			||||||
		if(istile)
 | 
					 | 
				
			||||||
			drawtext(tags[i], (i == tsel), True);
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			drawtext(tags[i], (i != tsel), True);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if(sel) {
 | 
					 | 
				
			||||||
		dc.x += dc.w;
 | 
					 | 
				
			||||||
		dc.w = textw(sel->name);
 | 
					 | 
				
			||||||
		drawtext(sel->name, istile, True);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	dc.w = textw(stext);
 | 
					 | 
				
			||||||
	dc.x = bx + bw - dc.w;
 | 
					 | 
				
			||||||
	drawtext(stext, !istile, False);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
 | 
					 | 
				
			||||||
	XFlush(dpy);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					 | 
				
			||||||
drawtext(const char *text, Bool invert, Bool border)
 | 
					drawtext(const char *text, Bool invert, Bool border)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int x, y, w, h;
 | 
						int x, y, w, h;
 | 
				
			||||||
| 
						 | 
					@ -123,6 +90,50 @@ drawtext(const char *text, Bool invert, Bool border)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* extern functions */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					drawall()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						Client *c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for(c = clients; c; c = getnext(c->next))
 | 
				
			||||||
 | 
							drawtitle(c);
 | 
				
			||||||
 | 
						drawstatus();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					drawstatus()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int i;
 | 
				
			||||||
 | 
						Bool istile = arrange == dotile;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						dc.x = dc.y = 0;
 | 
				
			||||||
 | 
						dc.w = bw;
 | 
				
			||||||
 | 
						drawtext(NULL, !istile, False);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						dc.w = 0;
 | 
				
			||||||
 | 
						for(i = 0; i < TLast; i++) {
 | 
				
			||||||
 | 
							dc.x += dc.w;
 | 
				
			||||||
 | 
							dc.w = textw(tags[i]);
 | 
				
			||||||
 | 
							if(istile)
 | 
				
			||||||
 | 
								drawtext(tags[i], (i == tsel), True);
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								drawtext(tags[i], (i != tsel), True);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if(sel) {
 | 
				
			||||||
 | 
							dc.x += dc.w;
 | 
				
			||||||
 | 
							dc.w = textw(sel->name);
 | 
				
			||||||
 | 
							drawtext(sel->name, istile, True);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						dc.w = textw(stext);
 | 
				
			||||||
 | 
						dc.x = bx + bw - dc.w;
 | 
				
			||||||
 | 
						drawtext(stext, !istile, False);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
 | 
				
			||||||
 | 
						XFlush(dpy);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
drawtitle(Client *c)
 | 
					drawtitle(Client *c)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -218,17 +229,6 @@ setfont(const char *fontstr)
 | 
				
			||||||
	dc.font.height = dc.font.ascent + dc.font.descent;
 | 
						dc.font.height = dc.font.ascent + dc.font.descent;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
unsigned int
 | 
					 | 
				
			||||||
textnw(char *text, unsigned int len)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	XRectangle r;
 | 
					 | 
				
			||||||
	if(dc.font.set) {
 | 
					 | 
				
			||||||
		XmbTextExtents(dc.font.set, text, len, NULL, &r);
 | 
					 | 
				
			||||||
		return r.width;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return XTextWidth(dc.font.xfont, text, len);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
unsigned int
 | 
					unsigned int
 | 
				
			||||||
textw(char *text)
 | 
					textw(char *text)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										4
									
								
								dwm.h
								
								
								
								
							
							
						
						
									
										4
									
								
								dwm.h
								
								
								
								
							| 
						 | 
					@ -89,7 +89,7 @@ struct Key {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern Display *dpy;
 | 
					extern Display *dpy;
 | 
				
			||||||
extern Window root, barwin;
 | 
					extern Window root, barwin;
 | 
				
			||||||
extern Atom wm_atom[WMLast], net_atom[NetLast];
 | 
					extern Atom wmatom[WMLast], netatom[NetLast];
 | 
				
			||||||
extern Cursor cursor[CurLast];
 | 
					extern Cursor cursor[CurLast];
 | 
				
			||||||
extern Bool running, issel;
 | 
					extern Bool running, issel;
 | 
				
			||||||
extern void (*handler[LASTEvent])(XEvent *);
 | 
					extern void (*handler[LASTEvent])(XEvent *);
 | 
				
			||||||
| 
						 | 
					@ -124,11 +124,9 @@ extern void zoom(Arg *arg);
 | 
				
			||||||
/* draw.c */
 | 
					/* draw.c */
 | 
				
			||||||
extern void drawall();
 | 
					extern void drawall();
 | 
				
			||||||
extern void drawstatus();
 | 
					extern void drawstatus();
 | 
				
			||||||
extern void drawtext(const char *text, Bool invert, Bool border);
 | 
					 | 
				
			||||||
extern void drawtitle(Client *c);
 | 
					extern void drawtitle(Client *c);
 | 
				
			||||||
extern unsigned long getcolor(const char *colstr);
 | 
					extern unsigned long getcolor(const char *colstr);
 | 
				
			||||||
extern void setfont(const char *fontstr);
 | 
					extern void setfont(const char *fontstr);
 | 
				
			||||||
extern unsigned int textnw(char *text, unsigned int len);
 | 
					 | 
				
			||||||
extern unsigned int textw(char *text);
 | 
					extern unsigned int textw(char *text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* event.c */
 | 
					/* event.c */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										141
									
								
								event.c
								
								
								
								
							
							
						
						
									
										141
									
								
								event.c
								
								
								
								
							| 
						 | 
					@ -51,8 +51,73 @@ Key key[] = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* static functions */
 | 
					/* static functions */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void movemouse(Client *c);
 | 
					static void
 | 
				
			||||||
static void resizemouse(Client *c);
 | 
					movemouse(Client *c)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						XEvent ev;
 | 
				
			||||||
 | 
						int x1, y1, ocx, ocy, di;
 | 
				
			||||||
 | 
						unsigned int dui;
 | 
				
			||||||
 | 
						Window dummy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ocx = c->x;
 | 
				
			||||||
 | 
						ocy = c->y;
 | 
				
			||||||
 | 
						if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
 | 
				
			||||||
 | 
									None, cursor[CurMove], CurrentTime) != GrabSuccess)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
 | 
				
			||||||
 | 
						for(;;) {
 | 
				
			||||||
 | 
							XMaskEvent(dpy, MouseMask | ExposureMask, &ev);
 | 
				
			||||||
 | 
							switch (ev.type) {
 | 
				
			||||||
 | 
							default: break;
 | 
				
			||||||
 | 
							case Expose:
 | 
				
			||||||
 | 
								handler[Expose](&ev);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							case MotionNotify:
 | 
				
			||||||
 | 
								XFlush(dpy);
 | 
				
			||||||
 | 
								c->x = ocx + (ev.xmotion.x - x1);
 | 
				
			||||||
 | 
								c->y = ocy + (ev.xmotion.y - y1);
 | 
				
			||||||
 | 
								resize(c, False);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							case ButtonRelease:
 | 
				
			||||||
 | 
								XUngrabPointer(dpy, CurrentTime);
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					resizemouse(Client *c)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						XEvent ev;
 | 
				
			||||||
 | 
						int ocx, ocy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ocx = c->x;
 | 
				
			||||||
 | 
						ocy = c->y;
 | 
				
			||||||
 | 
						if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
 | 
				
			||||||
 | 
									None, cursor[CurResize], CurrentTime) != GrabSuccess)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h);
 | 
				
			||||||
 | 
						for(;;) {
 | 
				
			||||||
 | 
							XMaskEvent(dpy, MouseMask | ExposureMask, &ev);
 | 
				
			||||||
 | 
							switch(ev.type) {
 | 
				
			||||||
 | 
							default: break;
 | 
				
			||||||
 | 
							case Expose:
 | 
				
			||||||
 | 
								handler[Expose](&ev);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							case MotionNotify:
 | 
				
			||||||
 | 
								XFlush(dpy);
 | 
				
			||||||
 | 
								c->w = abs(ocx - ev.xmotion.x);
 | 
				
			||||||
 | 
								c->h = abs(ocy - ev.xmotion.y);
 | 
				
			||||||
 | 
								c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - c->w;
 | 
				
			||||||
 | 
								c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - c->h;
 | 
				
			||||||
 | 
								resize(c, True);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							case ButtonRelease:
 | 
				
			||||||
 | 
								XUngrabPointer(dpy, CurrentTime);
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
buttonpress(XEvent *e)
 | 
					buttonpress(XEvent *e)
 | 
				
			||||||
| 
						 | 
					@ -213,40 +278,6 @@ maprequest(XEvent *e)
 | 
				
			||||||
		manage(ev->window, &wa);
 | 
							manage(ev->window, &wa);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					 | 
				
			||||||
movemouse(Client *c)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	XEvent ev;
 | 
					 | 
				
			||||||
	int x1, y1, ocx, ocy, di;
 | 
					 | 
				
			||||||
	unsigned int dui;
 | 
					 | 
				
			||||||
	Window dummy;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ocx = c->x;
 | 
					 | 
				
			||||||
	ocy = c->y;
 | 
					 | 
				
			||||||
	if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
 | 
					 | 
				
			||||||
				None, cursor[CurMove], CurrentTime) != GrabSuccess)
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
 | 
					 | 
				
			||||||
	for(;;) {
 | 
					 | 
				
			||||||
		XMaskEvent(dpy, MouseMask | ExposureMask, &ev);
 | 
					 | 
				
			||||||
		switch (ev.type) {
 | 
					 | 
				
			||||||
		default: break;
 | 
					 | 
				
			||||||
		case Expose:
 | 
					 | 
				
			||||||
			handler[Expose](&ev);
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case MotionNotify:
 | 
					 | 
				
			||||||
			XFlush(dpy);
 | 
					 | 
				
			||||||
			c->x = ocx + (ev.xmotion.x - x1);
 | 
					 | 
				
			||||||
			c->y = ocy + (ev.xmotion.y - y1);
 | 
					 | 
				
			||||||
			resize(c, False);
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case ButtonRelease:
 | 
					 | 
				
			||||||
			XUngrabPointer(dpy, CurrentTime);
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
propertynotify(XEvent *e)
 | 
					propertynotify(XEvent *e)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -258,7 +289,7 @@ propertynotify(XEvent *e)
 | 
				
			||||||
		return; /* ignore */
 | 
							return; /* ignore */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if((c = getclient(ev->window))) {
 | 
						if((c = getclient(ev->window))) {
 | 
				
			||||||
		if(ev->atom == wm_atom[WMProtocols]) {
 | 
							if(ev->atom == wmatom[WMProtocols]) {
 | 
				
			||||||
			c->proto = getproto(c->win);
 | 
								c->proto = getproto(c->win);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -273,47 +304,13 @@ propertynotify(XEvent *e)
 | 
				
			||||||
				setsize(c);
 | 
									setsize(c);
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if(ev->atom == XA_WM_NAME || ev->atom == net_atom[NetWMName]) {
 | 
							if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
 | 
				
			||||||
			settitle(c);
 | 
								settitle(c);
 | 
				
			||||||
			drawtitle(c);
 | 
								drawtitle(c);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					 | 
				
			||||||
resizemouse(Client *c)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	XEvent ev;
 | 
					 | 
				
			||||||
	int ocx, ocy;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ocx = c->x;
 | 
					 | 
				
			||||||
	ocy = c->y;
 | 
					 | 
				
			||||||
	if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
 | 
					 | 
				
			||||||
				None, cursor[CurResize], CurrentTime) != GrabSuccess)
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h);
 | 
					 | 
				
			||||||
	for(;;) {
 | 
					 | 
				
			||||||
		XMaskEvent(dpy, MouseMask | ExposureMask, &ev);
 | 
					 | 
				
			||||||
		switch(ev.type) {
 | 
					 | 
				
			||||||
		default: break;
 | 
					 | 
				
			||||||
		case Expose:
 | 
					 | 
				
			||||||
			handler[Expose](&ev);
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case MotionNotify:
 | 
					 | 
				
			||||||
			XFlush(dpy);
 | 
					 | 
				
			||||||
			c->w = abs(ocx - ev.xmotion.x);
 | 
					 | 
				
			||||||
			c->h = abs(ocy - ev.xmotion.y);
 | 
					 | 
				
			||||||
			c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - c->w;
 | 
					 | 
				
			||||||
			c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - c->h;
 | 
					 | 
				
			||||||
			resize(c, True);
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case ButtonRelease:
 | 
					 | 
				
			||||||
			XUngrabPointer(dpy, CurrentTime);
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
unmapnotify(XEvent *e)
 | 
					unmapnotify(XEvent *e)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										25
									
								
								main.c
								
								
								
								
							
							
						
						
									
										25
									
								
								main.c
								
								
								
								
							| 
						 | 
					@ -16,10 +16,10 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Display *dpy;
 | 
					Display *dpy;
 | 
				
			||||||
Window root, barwin;
 | 
					Window root, barwin;
 | 
				
			||||||
Atom wm_atom[WMLast], net_atom[NetLast];
 | 
					Atom wmatom[WMLast], netatom[NetLast];
 | 
				
			||||||
Cursor cursor[CurLast];
 | 
					Cursor cursor[CurLast];
 | 
				
			||||||
Bool running = True;
 | 
					Bool running = True;
 | 
				
			||||||
Bool issel;
 | 
					Bool issel = True;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int tsel = Tdev; /* default tag */
 | 
					int tsel = Tdev; /* default tag */
 | 
				
			||||||
int screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
 | 
					int screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
 | 
				
			||||||
| 
						 | 
					@ -30,8 +30,6 @@ Client *clients = NULL;
 | 
				
			||||||
Client *sel = NULL;
 | 
					Client *sel = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool otherwm;
 | 
					static Bool otherwm;
 | 
				
			||||||
static const char version[] =
 | 
					 | 
				
			||||||
	"dwm-" VERSION ", (C)opyright MMVI Anselm R. Garbe\n";
 | 
					 | 
				
			||||||
static int (*xerrorxlib)(Display *, XErrorEvent *);
 | 
					static int (*xerrorxlib)(Display *, XErrorEvent *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* static functions */
 | 
					/* static functions */
 | 
				
			||||||
| 
						 | 
					@ -109,12 +107,12 @@ getproto(Window w)
 | 
				
			||||||
	int protos = 0;
 | 
						int protos = 0;
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	res = win_property(w, wm_atom[WMProtocols], XA_ATOM, 20L, &protocols);
 | 
						res = win_property(w, wmatom[WMProtocols], XA_ATOM, 20L, &protocols);
 | 
				
			||||||
	if(res <= 0) {
 | 
						if(res <= 0) {
 | 
				
			||||||
		return protos;
 | 
							return protos;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for(i = 0; i < res; i++) {
 | 
						for(i = 0; i < res; i++) {
 | 
				
			||||||
		if(protocols[i] == wm_atom[WMDelete])
 | 
							if(protocols[i] == wmatom[WMDelete])
 | 
				
			||||||
			protos |= WM_PROTOCOL_DELWIN;
 | 
								protos |= WM_PROTOCOL_DELWIN;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	free((char *) protocols);
 | 
						free((char *) protocols);
 | 
				
			||||||
| 
						 | 
					@ -184,7 +182,8 @@ main(int argc, char *argv[])
 | 
				
			||||||
	for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) {
 | 
						for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) {
 | 
				
			||||||
		switch (argv[i][1]) {
 | 
							switch (argv[i][1]) {
 | 
				
			||||||
		case 'v':
 | 
							case 'v':
 | 
				
			||||||
			fprintf(stdout, "%s", version);
 | 
								fprintf(stdout, "%s",
 | 
				
			||||||
 | 
										"dwm-"VERSION", (C)opyright MMVI Anselm R. Garbe\n");
 | 
				
			||||||
			exit(0);
 | 
								exit(0);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
| 
						 | 
					@ -214,12 +213,12 @@ main(int argc, char *argv[])
 | 
				
			||||||
	xerrorxlib = XSetErrorHandler(xerror);
 | 
						xerrorxlib = XSetErrorHandler(xerror);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* init atoms */
 | 
						/* init atoms */
 | 
				
			||||||
	wm_atom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
 | 
						wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
 | 
				
			||||||
	wm_atom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
 | 
						wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
 | 
				
			||||||
	net_atom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
 | 
						netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
 | 
				
			||||||
	net_atom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
 | 
						netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
 | 
				
			||||||
	XChangeProperty(dpy, root, net_atom[NetSupported], XA_ATOM, 32,
 | 
						XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
 | 
				
			||||||
			PropModeReplace, (unsigned char *) net_atom, NetLast);
 | 
								PropModeReplace, (unsigned char *) netatom, NetLast);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* init cursors */
 | 
						/* init cursors */
 | 
				
			||||||
	cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
 | 
						cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue