aewl

changeset 80:8125f908c80c

several additions in mouse handling ;)
author Anselm R. Garbe <garbeam@wmii.de>
date Sun, 16 Jul 2006 00:47:40 +0200
parents aabebd6e61f3
children 92f0d50475be
files client.c dwm.1 dwm.h event.c tag.c
diffstat 5 files changed, 60 insertions(+), 66 deletions(-) [+]
line diff
     1.1 --- a/client.c	Sat Jul 15 18:51:44 2006 +0200
     1.2 +++ b/client.c	Sun Jul 16 00:47:40 2006 +0200
     1.3 @@ -192,7 +192,7 @@
     1.4  void
     1.5  manage(Window w, XWindowAttributes *wa)
     1.6  {
     1.7 -	Client *c, **l;
     1.8 +	Client *c;
     1.9  	XSetWindowAttributes twa;
    1.10  	Window trans;
    1.11  
    1.12 @@ -223,10 +223,11 @@
    1.13  	settitle(c);
    1.14  	settags(c);
    1.15  
    1.16 -	for(l = &clients; *l; l = &(*l)->next);
    1.17 -	c->next = *l; /* *l == nil */
    1.18 -	*l = c;
    1.19 +	c->next = clients;
    1.20 +	clients = c;
    1.21  
    1.22 +	XGrabButton(dpy, Button1, ControlMask, c->win, False, ButtonPressMask,
    1.23 +			GrabModeAsync, GrabModeSync, None, None);
    1.24  	XGrabButton(dpy, Button1, Mod1Mask, c->win, False, ButtonPressMask,
    1.25  			GrabModeAsync, GrabModeSync, None, None);
    1.26  	XGrabButton(dpy, Button2, Mod1Mask, c->win, False, ButtonPressMask,
    1.27 @@ -234,8 +235,8 @@
    1.28  	XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask,
    1.29  			GrabModeAsync, GrabModeSync, None, None);
    1.30  
    1.31 -	if(!c->dofloat)
    1.32 -		c->dofloat = trans
    1.33 +	if(!c->isfloat)
    1.34 +		c->isfloat = trans
    1.35  			|| ((c->maxw == c->minw) && (c->maxh == c->minh));
    1.36  
    1.37  	arrange(NULL);
     2.1 --- a/dwm.1	Sat Jul 15 18:51:44 2006 +0200
     2.2 +++ b/dwm.1	Sun Jul 16 00:47:40 2006 +0200
     2.3 @@ -5,63 +5,44 @@
     2.4  .B dwm
     2.5  .RB [ \-v ]
     2.6  .SH DESCRIPTION
     2.7 -.SS Overview
     2.8  .B dwm
     2.9 -is a dynamic window manager for X11. It consists of a small status bar at the
    2.10 -top of the screen and arranges windows in either a tiled or floating mode.
    2.11 +is a dynamic window manager for X11. It consists of a small status bar and
    2.12 +arranges windows in either a tiled or floating mode.
    2.13  .P
    2.14 -If 
    2.15 +In tiled mode
    2.16  .B dwm
    2.17 -is in tiled mode, it consists of two columns. The left master column
    2.18 -contains only one window per time, the right column contains all other windows 
    2.19 -in a stack. In tiled mode
    2.20 +manages all windows in a left master column and a right stacking column. The
    2.21 +master column contains a single window, the left stacking column all other
    2.22 +windows. Dialog windows are treated floating.
    2.23 +.P
    2.24 +In floating mode
    2.25  .B dwm
    2.26 -.B don't
    2.27 -handles incremental resizals, some terminal programs like
    2.28 -.B xterm
    2.29 -may not work correctly with this in tiled mode.
    2.30 -.P
    2.31 -If
    2.32 -.B dwm
    2.33 -is in floating mode, it arranges all windows with the reqyested geometry and
    2.34 -allows the user to move or resize them. Some windows, like
    2.35 -dialog windows, are treated floating even if
    2.36 -.B dwm
    2.37 -is in tiled mode. In floating mode
    2.38 -.B dwm
    2.39 -handles incremental resizals.
    2.40 +manages all windows in a conventional way. They can be resized and moved freely
    2.41 +with the mouse.
    2.42  .P
    2.43  Windows are grouped by tags. You can view all windows with a specific tag per
    2.44  time.  However, each window is allowed to contain more than one tag, which
    2.45  allows to make windows visible in all views.
    2.46  .P
    2.47  .B dwm
    2.48 -reads from
    2.49 -.I stdin
    2.50 -to display status text, if written.
    2.51 +reads from standard input to display status text, if written.
    2.52  .P
    2.53  .B dwm
    2.54 -draws 1-pixel borders around windows to indicate the focus state and save as
    2.55 +draws 1-pixel borders around windows to indicate the focus state and providing as
    2.56  much screen real estate as possible. Unfocused windows contain a small bar
    2.57  in front of the window indicating the tags and the window title.
    2.58 -.SS Options
    2.59 +.SH OPTIONS
    2.60  .TP
    2.61  .B \-v
    2.62 -prints version information to
    2.63 -.I stdout
    2.64 -, then exits.
    2.65 -.SS Customization
    2.66 +prints version information to standard output, then exits.
    2.67 +.SH CUSTOMIZATION
    2.68  .B dwm
    2.69  is customized through editing its source code. It is assumed that
    2.70 -dwm users are high experienced users who know how a window manager works
    2.71 -and who are able to patch
    2.72  .B dwm
    2.73 -for their needs. This keeps
    2.74 -.B dwm
    2.75 -fast, secure and simple, because it does not process any input data, except
    2.76 -window properties and the status text read from
    2.77 -.I stdin .
    2.78 -.SS Default Key Bindings
    2.79 +users know to patch it for their needs. This keeps it fast, secure and simple,
    2.80 +because it does not process any input data, except window properties and
    2.81 +the status text read from standard input.
    2.82 +.SS Keyboard Control
    2.83  .TP 16
    2.84  .I Key	
    2.85  .I Action
    2.86 @@ -71,7 +52,7 @@
    2.87  .B window
    2.88  to the 
    2.89  .B master
    2.90 -track
    2.91 +column
    2.92  .TP
    2.93  .B Mod1-k
    2.94  Focus previous
    2.95 @@ -127,7 +108,7 @@
    2.96  .B nth
    2.97  tag to cureent
    2.98  .B window
    2.99 -.SS Default Mouse Bindings
   2.100 +.SS Mouse Control
   2.101  .TP
   2.102  .B Mod1-Button1
   2.103  Moves current
   2.104 @@ -142,7 +123,3 @@
   2.105  Resizes current
   2.106  .B window
   2.107  while dragging
   2.108 -.SH BUGS
   2.109 -Some terminal programs do not behave correctly in tiled mode, because
   2.110 -incremental resizals are ignored to use maximum screen real estate. You can
   2.111 -patch the code to fix this.
     3.1 --- a/dwm.h	Sat Jul 15 18:51:44 2006 +0200
     3.2 +++ b/dwm.h	Sun Jul 16 00:47:40 2006 +0200
     3.3 @@ -71,7 +71,7 @@
     3.4  	int grav;
     3.5  	unsigned int border;
     3.6  	long flags; 
     3.7 -	Bool dofloat;
     3.8 +	Bool isfloat;
     3.9  	Window win;
    3.10  	Window title;
    3.11  	Client *next;
    3.12 @@ -82,7 +82,7 @@
    3.13  	const char *class;
    3.14  	const char *instance;
    3.15  	char *tags[TLast];
    3.16 -	Bool dofloat;
    3.17 +	Bool isfloat;
    3.18  };
    3.19  
    3.20  struct Key {
     4.1 --- a/event.c	Sat Jul 15 18:51:44 2006 +0200
     4.2 +++ b/event.c	Sun Jul 16 00:47:40 2006 +0200
     4.3 @@ -14,8 +14,8 @@
     4.4  /********** CUSTOMIZE **********/
     4.5  
     4.6  const char *term[] = { 
     4.7 -	"urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn",
     4.8 -	"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL
     4.9 +	"urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white",
    4.10 +	"-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL
    4.11  };
    4.12  const char *browse[] = { "firefox", NULL };
    4.13  const char *xlock[] = { "xlock", NULL };
    4.14 @@ -128,18 +128,34 @@
    4.15  	Client *c;
    4.16  
    4.17  	if(barwin == ev->window) {
    4.18 -		x = 0;
    4.19 -		for(a.i = 0; a.i < TLast; a.i++) {
    4.20 -			x += textw(tags[a.i]);
    4.21 -			if(ev->x < x) {
    4.22 -				view(&a);
    4.23 -				break;
    4.24 +		switch(ev->button) {
    4.25 +		default:
    4.26 +			x = 0;
    4.27 +			for(a.i = 0; a.i < TLast; a.i++) {
    4.28 +				x += textw(tags[a.i]);
    4.29 +				if(ev->x < x) {
    4.30 +					view(&a);
    4.31 +					break;
    4.32 +				}
    4.33  			}
    4.34 +			break;
    4.35 +		case Button4:
    4.36 +			a.i = (tsel + 1 < TLast) ? tsel + 1 : 0;
    4.37 +			view(&a);
    4.38 +			break;
    4.39 +		case Button5:
    4.40 +			a.i = (tsel - 1 >= 0) ? tsel - 1 : TLast - 1;
    4.41 +			view(&a);
    4.42 +			break;
    4.43  		}
    4.44  	}
    4.45  	else if((c = getclient(ev->window))) {
    4.46 -		if(arrange == dotile && !c->dofloat)
    4.47 +		if(arrange == dotile && !c->isfloat) {
    4.48 +			if((ev->state & ControlMask) && (ev->button == Button1))
    4.49 +				zoom(NULL);
    4.50  			return;
    4.51 +		}
    4.52 +		/* floating windows */
    4.53  		higher(c);
    4.54  		switch(ev->button) {
    4.55  		default:
    4.56 @@ -297,7 +313,7 @@
    4.57  			default: break;
    4.58  			case XA_WM_TRANSIENT_FOR:
    4.59  				XGetTransientForHint(dpy, c->win, &trans);
    4.60 -				if(!c->dofloat && (c->dofloat = (trans != 0)))
    4.61 +				if(!c->isfloat && (c->isfloat = (trans != 0)))
    4.62  					arrange(NULL);
    4.63  				break;
    4.64  			case XA_WM_NORMAL_HINTS:
     5.1 --- a/tag.c	Sat Jul 15 18:51:44 2006 +0200
     5.2 +++ b/tag.c	Sun Jul 16 00:47:40 2006 +0200
     5.3 @@ -17,7 +17,7 @@
     5.4  };
     5.5  
     5.6  static Rule rule[] = {
     5.7 -	/* class			instance	tags						dofloat */
     5.8 +	/* class			instance	tags						isfloat */
     5.9  	{ "Firefox-bin",	"Gecko",	{ [Twww] = "www" },			False },
    5.10  };
    5.11  
    5.12 @@ -67,7 +67,7 @@
    5.13  	w = sw - mw;
    5.14  	arrange = dotile;
    5.15  	for(n = 0, c = clients; c; c = c->next)
    5.16 -		if(c->tags[tsel] && !c->dofloat)
    5.17 +		if(c->tags[tsel] && !c->isfloat)
    5.18  			n++;
    5.19  
    5.20  	if(n > 1)
    5.21 @@ -77,7 +77,7 @@
    5.22  
    5.23  	for(i = 0, c = clients; c; c = c->next) {
    5.24  		if(c->tags[tsel]) {
    5.25 -			if(c->dofloat) {
    5.26 +			if(c->isfloat) {
    5.27  				higher(c);
    5.28  				resize(c, True);
    5.29  				continue;
    5.30 @@ -155,7 +155,7 @@
    5.31  				{
    5.32  					for(j = 0; j < TLast; j++)
    5.33  						c->tags[j] = rule[i].tags[j];
    5.34 -					c->dofloat = rule[i].dofloat;
    5.35 +					c->isfloat = rule[i].isfloat;
    5.36  					matched = True;
    5.37  					break;
    5.38  				}