aewl

changeset 687:a76799907854

removed client title bar
author Anselm R. Garbe <arg@suckless.org>
date Sun, 14 Jan 2007 22:27:29 +0100
parents 4fd68b1485eb
children 39fa5308d73f
files client.c draw.c dwm.1 dwm.h event.c view.c
diffstat 6 files changed, 10 insertions(+), 73 deletions(-) [+]
line diff
     1.1 --- a/client.c	Fri Jan 12 21:56:01 2007 +0100
     1.2 +++ b/client.c	Sun Jan 14 22:27:29 2007 +0100
     1.3 @@ -61,12 +61,6 @@
     1.4  /* extern functions */
     1.5  
     1.6  void
     1.7 -ban(Client *c) {
     1.8 -	XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
     1.9 -	XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty);
    1.10 -}
    1.11 -
    1.12 -void
    1.13  configure(Client *c) {
    1.14  	XEvent synev;
    1.15  
    1.16 @@ -121,16 +115,6 @@
    1.17  	return NULL;
    1.18  }
    1.19  
    1.20 -Client *
    1.21 -getctitle(Window w) {
    1.22 -	Client *c;
    1.23 -
    1.24 -	for(c = clients; c; c = c->next)
    1.25 -		if(c->twin == w)
    1.26 -			return c;
    1.27 -	return NULL;
    1.28 -}
    1.29 -
    1.30  void
    1.31  killclient(Arg *arg) {
    1.32  	if(!sel)
    1.33 @@ -145,17 +129,15 @@
    1.34  manage(Window w, XWindowAttributes *wa) {
    1.35  	Client *c;
    1.36  	Window trans;
    1.37 -	XSetWindowAttributes twa;
    1.38  
    1.39  	c = emallocz(sizeof(Client));
    1.40  	c->tags = emallocz(ntags * sizeof(Bool));
    1.41  	c->win = w;
    1.42  	c->border = 0;
    1.43 -	c->x = c->tx = wa->x;
    1.44 -	c->y = c->ty = wa->y;
    1.45 -	c->w = c->tw = wa->width;
    1.46 +	c->x = wa->x;
    1.47 +	c->y = wa->y;
    1.48 +	c->w = wa->width;
    1.49  	c->h = wa->height;
    1.50 -	c->th = bh;
    1.51  	updatesizehints(c);
    1.52  	if(c->x + c->w + 2 * BORDERPX > sw)
    1.53  		c->x = sw - c->w - 2 * BORDERPX;
    1.54 @@ -169,27 +151,18 @@
    1.55  	XSelectInput(dpy, c->win,
    1.56  		StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
    1.57  	XGetTransientForHint(dpy, c->win, &trans);
    1.58 -	twa.override_redirect = 1;
    1.59 -	twa.background_pixmap = ParentRelative;
    1.60 -	twa.event_mask = ExposureMask | EnterWindowMask;
    1.61 -	c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
    1.62 -			0, DefaultDepth(dpy, screen), CopyFromParent,
    1.63 -			DefaultVisual(dpy, screen),
    1.64 -			CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
    1.65  	grabbuttons(c, False);
    1.66  	updatetitle(c);
    1.67  	settags(c, getclient(trans));
    1.68  	if(!c->isfloat)
    1.69  		c->isfloat = trans || c->isfixed;
    1.70 -	resizetitle(c);
    1.71  	if(clients)
    1.72  		clients->prev = c;
    1.73  	c->next = clients;
    1.74  	c->snext = stack;
    1.75  	stack = clients = c;
    1.76 -	ban(c);
    1.77 +	XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
    1.78  	XMapWindow(dpy, c->win);
    1.79 -	XMapWindow(dpy, c->twin);
    1.80  	if(isvisible(c))
    1.81  		focus(c);
    1.82  	arrange();
    1.83 @@ -228,7 +201,6 @@
    1.84  		c->x = sw - c->w;
    1.85  	if(c->y > sh)
    1.86  		c->y = sh - c->h;
    1.87 -	resizetitle(c);
    1.88  	wc.x = c->x;
    1.89  	wc.y = c->y;
    1.90  	wc.width = c->w;
    1.91 @@ -243,19 +215,6 @@
    1.92  }
    1.93  
    1.94  void
    1.95 -resizetitle(Client *c) {
    1.96 -	c->tw = textw(c->name);
    1.97 -	if(c->tw > c->w)
    1.98 -		c->tw = c->w + 2 * BORDERPX;
    1.99 -	c->tx = c->x + c->w - c->tw + 2 * BORDERPX;
   1.100 -	c->ty = c->y;
   1.101 -	if(isvisible(c))
   1.102 -		XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th);
   1.103 -	else
   1.104 -		XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th);
   1.105 -}
   1.106 -
   1.107 -void
   1.108  updatesizehints(Client *c) {
   1.109  	long msize;
   1.110  	XSizeHints size;
   1.111 @@ -331,7 +290,6 @@
   1.112  		focus(nc);
   1.113  	}
   1.114  	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
   1.115 -	XDestroyWindow(dpy, c->twin);
   1.116  	free(c->tags);
   1.117  	free(c);
   1.118  	XSync(dpy, False);
     2.1 --- a/draw.c	Fri Jan 12 21:56:01 2007 +0100
     2.2 +++ b/draw.c	Sun Jan 14 22:27:29 2007 +0100
     2.3 @@ -141,16 +141,10 @@
     2.4  drawclient(Client *c) {
     2.5  	if(c == sel && issel) {
     2.6  		drawstatus();
     2.7 -		XUnmapWindow(dpy, c->twin);
     2.8  		XSetWindowBorder(dpy, c->win, dc.sel[ColBG]);
     2.9  		return;
    2.10  	}
    2.11  	XSetWindowBorder(dpy, c->win, dc.norm[ColBG]);
    2.12 -	XMapWindow(dpy, c->twin);
    2.13 -	dc.x = dc.y = 0;
    2.14 -	dc.w = c->tw;
    2.15 -	drawtext(c->name, dc.norm, False, False);
    2.16 -	XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0);
    2.17  	XSync(dpy, False);
    2.18  }
    2.19  
     3.1 --- a/dwm.1	Fri Jan 12 21:56:01 2007 +0100
     3.2 +++ b/dwm.1	Sun Jan 14 22:27:29 2007 +0100
     3.3 @@ -26,7 +26,6 @@
     3.4  the top left corner.
     3.5  .P
     3.6  dwm draws a 1-pixel border around windows to indicate the focus state.
     3.7 -Unfocused windows contain a small bar in front of them displaying their title.
     3.8  .SH OPTIONS
     3.9  .TP
    3.10  .B \-v
     4.1 --- a/dwm.h	Fri Jan 12 21:56:01 2007 +0100
     4.2 +++ b/dwm.h	Sun Jan 14 22:27:29 2007 +0100
     4.3 @@ -78,7 +78,6 @@
     4.4  	int proto;
     4.5  	int x, y, w, h;
     4.6  	int rx, ry, rw, rh; /* revert geometry */
     4.7 -	int tx, ty, tw, th; /* title window geometry */
     4.8  	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
     4.9  	long flags; 
    4.10  	unsigned int border;
    4.11 @@ -88,7 +87,6 @@
    4.12  	Client *prev;
    4.13  	Client *snext;
    4.14  	Window win;
    4.15 -	Window twin;
    4.16  };
    4.17  
    4.18  extern const char *tags[];			/* all tags */
    4.19 @@ -110,15 +108,12 @@
    4.20  extern Window root, barwin;
    4.21  
    4.22  /* client.c */
    4.23 -extern void ban(Client *c);			/* ban c from screen */
    4.24  extern void configure(Client *c);		/* send synthetic configure event */
    4.25  extern void focus(Client *c);			/* focus c, c may be NULL */
    4.26  extern Client *getclient(Window w);		/* return client of w */
    4.27 -extern Client *getctitle(Window w);		/* return client of title window */
    4.28  extern void killclient(Arg *arg);		/* kill c nicely */
    4.29  extern void manage(Window w, XWindowAttributes *wa);	/* manage new client */
    4.30  extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
    4.31 -extern void resizetitle(Client *c);		/* resizes c->twin correctly */
    4.32  extern void updatesizehints(Client *c);		/* update the size hint variables of c */
    4.33  extern void updatetitle(Client *c);		/* update the name of c */
    4.34  extern void unmanage(Client *c);		/* destroy c */
     5.1 --- a/event.c	Fri Jan 12 21:56:01 2007 +0100
     5.2 +++ b/event.c	Sun Jan 14 22:27:29 2007 +0100
     5.3 @@ -196,7 +196,7 @@
     5.4  		if(c->isfloat) {
     5.5  			resize(c, False, TopLeft);
     5.6  			if(!isvisible(c))
     5.7 -				ban(c);
     5.8 +				XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
     5.9  		}
    5.10  		else
    5.11  			arrange();
    5.12 @@ -230,7 +230,7 @@
    5.13  
    5.14  	if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
    5.15  		return;
    5.16 -	if(((c = getclient(ev->window)) || (c = getctitle(ev->window))) && isvisible(c))
    5.17 +	if((c = getclient(ev->window)) && isvisible(c))
    5.18  		focus(c);
    5.19  	else if(ev->window == root) {
    5.20  		issel = True;
    5.21 @@ -247,8 +247,6 @@
    5.22  	if(ev->count == 0) {
    5.23  		if(barwin == ev->window)
    5.24  			drawstatus();
    5.25 -		else if((c = getctitle(ev->window)))
    5.26 -			drawclient(c);
    5.27  	}
    5.28  }
    5.29  
    5.30 @@ -331,7 +329,6 @@
    5.31  		}
    5.32  		if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
    5.33  			updatetitle(c);
    5.34 -			resizetitle(c);
    5.35  			drawclient(c);
    5.36  		}
    5.37  	}
     6.1 --- a/view.c	Fri Jan 12 21:56:01 2007 +0100
     6.2 +++ b/view.c	Sun Jan 14 22:27:29 2007 +0100
     6.3 @@ -59,7 +59,7 @@
     6.4  			resize(c, True, TopLeft);
     6.5  		}
     6.6  		else
     6.7 -			ban(c);
     6.8 +			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
     6.9  	}
    6.10  	if(!sel || !isvisible(sel)) {
    6.11  		for(c = stack; c && !isvisible(c); c = c->snext);
    6.12 @@ -109,8 +109,7 @@
    6.13  			i++;
    6.14  		}
    6.15  		else
    6.16 -			ban(c);
    6.17 -
    6.18 +			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
    6.19  	if(!sel || !isvisible(sel)) {
    6.20  		for(c = stack; c && !isvisible(c); c = c->snext);
    6.21  		focus(c);
    6.22 @@ -191,19 +190,14 @@
    6.23  		drawstatus();
    6.24  		return;
    6.25  	}
    6.26 -	if(sel->isfloat || arrange == dofloat) {
    6.27 +	if(sel->isfloat || arrange == dofloat)
    6.28  		XRaiseWindow(dpy, sel->win);
    6.29 -		XRaiseWindow(dpy, sel->twin);
    6.30 -	}
    6.31  	if(arrange != dofloat) {
    6.32 -		if(!sel->isfloat) {
    6.33 -			XLowerWindow(dpy, sel->twin);
    6.34 +		if(!sel->isfloat)
    6.35  			XLowerWindow(dpy, sel->win);
    6.36 -		}
    6.37  		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
    6.38  			if(c == sel)
    6.39  				continue;
    6.40 -			XLowerWindow(dpy, c->twin);
    6.41  			XLowerWindow(dpy, c->win);
    6.42  		}
    6.43  	}