tseveral additions in mouse handling ;) - dwm - [fork] customized build of dwm,… | |
git clone git://src.adamsgaard.dk/dwm | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 901b3ed9b7e3e4c7542797301ae2442938bcea20 | |
parent e6cbe9c11e88537d74eb094ba5844f71ee57f268 | |
Author: Anselm R. Garbe <[email protected]> | |
Date: Sun, 16 Jul 2006 00:47:40 +0200 | |
several additions in mouse handling ;) | |
Diffstat: | |
M client.c | 13 +++++++------ | |
M dwm.1 | 63 ++++++++++-------------------… | |
M dwm.h | 4 ++-- | |
M event.c | 36 ++++++++++++++++++++++-------… | |
M tag.c | 8 ++++---- | |
5 files changed, 59 insertions(+), 65 deletions(-) | |
--- | |
diff --git a/client.c b/client.c | |
t@@ -192,7 +192,7 @@ lower(Client *c) | |
void | |
manage(Window w, XWindowAttributes *wa) | |
{ | |
- Client *c, **l; | |
+ Client *c; | |
XSetWindowAttributes twa; | |
Window trans; | |
t@@ -223,10 +223,11 @@ manage(Window w, XWindowAttributes *wa) | |
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, | |
t@@ -234,8 +235,8 @@ manage(Window w, XWindowAttributes *wa) | |
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 --git a/dwm.1 b/dwm.1 | |
t@@ -5,63 +5,44 @@ dwm \- dynamic window manager | |
.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 | |
-.B dwm | |
-.B don't | |
-handles incremental resizals, some terminal programs like | |
-.B xterm | |
-may not work correctly with this 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 | |
-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 | |
+In floating mode | |
.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… | |
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 | |
t@@ -71,7 +52,7 @@ Zoom | |
.B window | |
to the | |
.B master | |
-track | |
+column | |
.TP | |
.B Mod1-k | |
Focus previous | |
t@@ -127,7 +108,7 @@ Append | |
.B nth | |
tag to cureent | |
.B window | |
-.SS Default Mouse Bindings | |
+.SS Mouse Control | |
.TP | |
.B Mod1-Button1 | |
Moves current | |
t@@ -142,7 +123,3 @@ Lowers current | |
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 --git a/dwm.h b/dwm.h | |
t@@ -71,7 +71,7 @@ struct Client { | |
int grav; | |
unsigned int border; | |
long flags; | |
- Bool dofloat; | |
+ Bool isfloat; | |
Window win; | |
Window title; | |
Client *next; | |
t@@ -82,7 +82,7 @@ struct Rule { | |
const char *class; | |
const char *instance; | |
char *tags[TLast]; | |
- Bool dofloat; | |
+ Bool isfloat; | |
}; | |
struct Key { | |
diff --git a/event.c b/event.c | |
t@@ -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 }; | |
t@@ -128,18 +128,34 @@ buttonpress(XEvent *e) | |
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: | |
t@@ -297,7 +313,7 @@ propertynotify(XEvent *e) | |
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 --git a/tag.c b/tag.c | |
t@@ -17,7 +17,7 @@ char *tags[TLast] = { | |
}; | |
static Rule rule[] = { | |
- /* class instance tags … | |
+ /* class instance tags … | |
{ "Firefox-bin", "Gecko", { [Twww] = "www" }, … | |
}; | |
t@@ -67,7 +67,7 @@ dotile(Arg *arg) | |
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) | |
t@@ -77,7 +77,7 @@ dotile(Arg *arg) | |
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; | |
t@@ -155,7 +155,7 @@ settags(Client *c) | |
{ | |
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; | |
} |