# HG changeset patch # User Anselm R. Garbe # Date 1153003660 -7200 # Node ID 8125f908c80c8797381ee2bf99d97ad9cb9335d5 # Parent aabebd6e61f3c5220af213ab54313235a8a84f31 several additions in mouse handling ;) diff -r aabebd6e61f3 -r 8125f908c80c client.c --- a/client.c Sat Jul 15 18:51:44 2006 +0200 +++ b/client.c Sun Jul 16 00:47:40 2006 +0200 @@ -192,7 +192,7 @@ void manage(Window w, XWindowAttributes *wa) { - Client *c, **l; + Client *c; XSetWindowAttributes twa; Window trans; @@ -223,10 +223,11 @@ settitle(c); settags(c); - for(l = &clients; *l; l = &(*l)->next); - c->next = *l; /* *l == nil */ - *l = c; + c->next = clients; + clients = c; + XGrabButton(dpy, Button1, ControlMask, c->win, False, ButtonPressMask, + GrabModeAsync, GrabModeSync, None, None); XGrabButton(dpy, Button1, Mod1Mask, c->win, False, ButtonPressMask, GrabModeAsync, GrabModeSync, None, None); XGrabButton(dpy, Button2, Mod1Mask, c->win, False, ButtonPressMask, @@ -234,8 +235,8 @@ XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask, GrabModeAsync, GrabModeSync, None, None); - if(!c->dofloat) - c->dofloat = trans + if(!c->isfloat) + c->isfloat = trans || ((c->maxw == c->minw) && (c->maxh == c->minh)); arrange(NULL); diff -r aabebd6e61f3 -r 8125f908c80c dwm.1 --- a/dwm.1 Sat Jul 15 18:51:44 2006 +0200 +++ b/dwm.1 Sun Jul 16 00:47:40 2006 +0200 @@ -5,63 +5,44 @@ .B dwm .RB [ \-v ] .SH DESCRIPTION -.SS Overview .B dwm -is a dynamic window manager for X11. It consists of a small status bar at the -top of the screen and arranges windows in either a tiled or floating mode. +is a dynamic window manager for X11. It consists of a small status bar and +arranges windows in either a tiled or floating mode. .P -If +In tiled mode .B dwm -is in tiled mode, it consists of two columns. The left master column -contains only one window per time, the right column contains all other windows -in a stack. In tiled mode +manages all windows in a left master column and a right stacking column. The +master column contains a single window, the left stacking column all other +windows. Dialog windows are treated floating. +.P +In floating mode .B dwm -.B don't -handles incremental resizals, some terminal programs like -.B xterm -may not work correctly with this in tiled mode. -.P -If -.B dwm -is in floating mode, it arranges all windows with the reqyested geometry and -allows the user to move or resize them. Some windows, like -dialog windows, are treated floating even if -.B dwm -is in tiled mode. In floating mode -.B dwm -handles incremental resizals. +manages all windows in a conventional way. They can be resized and moved freely +with the mouse. .P Windows are grouped by tags. You can view all windows with a specific tag per time. However, each window is allowed to contain more than one tag, which allows to make windows visible in all views. .P .B dwm -reads from -.I stdin -to display status text, if written. +reads from standard input to display status text, if written. .P .B dwm -draws 1-pixel borders around windows to indicate the focus state and save as +draws 1-pixel borders around windows to indicate the focus state and providing as much screen real estate as possible. Unfocused windows contain a small bar in front of the window indicating the tags and the window title. -.SS Options +.SH OPTIONS .TP .B \-v -prints version information to -.I stdout -, then exits. -.SS Customization +prints version information to standard output, then exits. +.SH CUSTOMIZATION .B dwm is customized through editing its source code. It is assumed that -dwm users are high experienced users who know how a window manager works -and who are able to patch .B dwm -for their needs. This keeps -.B dwm -fast, secure and simple, because it does not process any input data, except -window properties and the status text read from -.I stdin . -.SS Default Key Bindings +users know to patch it for their needs. This keeps it fast, secure and simple, +because it does not process any input data, except window properties and +the status text read from standard input. +.SS Keyboard Control .TP 16 .I Key .I Action @@ -71,7 +52,7 @@ .B window to the .B master -track +column .TP .B Mod1-k Focus previous @@ -127,7 +108,7 @@ .B nth tag to cureent .B window -.SS Default Mouse Bindings +.SS Mouse Control .TP .B Mod1-Button1 Moves current @@ -142,7 +123,3 @@ Resizes current .B window while dragging -.SH BUGS -Some terminal programs do not behave correctly in tiled mode, because -incremental resizals are ignored to use maximum screen real estate. You can -patch the code to fix this. diff -r aabebd6e61f3 -r 8125f908c80c dwm.h --- a/dwm.h Sat Jul 15 18:51:44 2006 +0200 +++ b/dwm.h Sun Jul 16 00:47:40 2006 +0200 @@ -71,7 +71,7 @@ int grav; unsigned int border; long flags; - Bool dofloat; + Bool isfloat; Window win; Window title; Client *next; @@ -82,7 +82,7 @@ const char *class; const char *instance; char *tags[TLast]; - Bool dofloat; + Bool isfloat; }; struct Key { diff -r aabebd6e61f3 -r 8125f908c80c event.c --- a/event.c Sat Jul 15 18:51:44 2006 +0200 +++ b/event.c Sun Jul 16 00:47:40 2006 +0200 @@ -14,8 +14,8 @@ /********** CUSTOMIZE **********/ const char *term[] = { - "urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn", - "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL + "urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white", + "-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL }; const char *browse[] = { "firefox", NULL }; const char *xlock[] = { "xlock", NULL }; @@ -128,18 +128,34 @@ Client *c; if(barwin == ev->window) { - x = 0; - for(a.i = 0; a.i < TLast; a.i++) { - x += textw(tags[a.i]); - if(ev->x < x) { - view(&a); - break; + switch(ev->button) { + default: + x = 0; + for(a.i = 0; a.i < TLast; a.i++) { + x += textw(tags[a.i]); + if(ev->x < x) { + view(&a); + break; + } } + break; + case Button4: + a.i = (tsel + 1 < TLast) ? tsel + 1 : 0; + view(&a); + break; + case Button5: + a.i = (tsel - 1 >= 0) ? tsel - 1 : TLast - 1; + view(&a); + break; } } else if((c = getclient(ev->window))) { - if(arrange == dotile && !c->dofloat) + if(arrange == dotile && !c->isfloat) { + if((ev->state & ControlMask) && (ev->button == Button1)) + zoom(NULL); return; + } + /* floating windows */ higher(c); switch(ev->button) { default: @@ -297,7 +313,7 @@ default: break; case XA_WM_TRANSIENT_FOR: XGetTransientForHint(dpy, c->win, &trans); - if(!c->dofloat && (c->dofloat = (trans != 0))) + if(!c->isfloat && (c->isfloat = (trans != 0))) arrange(NULL); break; case XA_WM_NORMAL_HINTS: diff -r aabebd6e61f3 -r 8125f908c80c tag.c --- a/tag.c Sat Jul 15 18:51:44 2006 +0200 +++ b/tag.c Sun Jul 16 00:47:40 2006 +0200 @@ -17,7 +17,7 @@ }; static Rule rule[] = { - /* class instance tags dofloat */ + /* class instance tags isfloat */ { "Firefox-bin", "Gecko", { [Twww] = "www" }, False }, }; @@ -67,7 +67,7 @@ w = sw - mw; arrange = dotile; for(n = 0, c = clients; c; c = c->next) - if(c->tags[tsel] && !c->dofloat) + if(c->tags[tsel] && !c->isfloat) n++; if(n > 1) @@ -77,7 +77,7 @@ for(i = 0, c = clients; c; c = c->next) { if(c->tags[tsel]) { - if(c->dofloat) { + if(c->isfloat) { higher(c); resize(c, True); continue; @@ -155,7 +155,7 @@ { for(j = 0; j < TLast; j++) c->tags[j] = rule[i].tags[j]; - c->dofloat = rule[i].dofloat; + c->isfloat = rule[i].isfloat; matched = True; break; }