Compare commits

..

23 Commits
3.4 ... 3.5

Author SHA1 Message Date
2d7f59424c simplifying regexps in config samples 2007-02-14 09:31:23 +01:00
e256afe31e made for/if/else constructs more consistent, some code polishing 2007-02-14 09:09:18 +01:00
64cfebc5e7 made configurerequest more tidy 2007-02-14 08:14:41 +01:00
7a095d0ce2 I didn't knew of c->isfixed, that should fix Jukkas issue with gkrellm ;) 2007-02-13 22:53:58 +01:00
5052c538d9 making it more sure that transient checks will work in any case 2007-02-13 22:24:27 +01:00
22d8c6fd18 stupid me, one needs to set c->{x,y,w,h} in configurerequest obviously ;) 2007-02-13 14:59:58 +01:00
71857b87ee simplified configurerequest 2007-02-13 13:39:33 +01:00
6ba400ee0f yet another consistency fix of dwm 2007-02-12 17:20:51 +01:00
35e65ea640 I don't see any reason why we should select for input on override-redirect windows? 2007-02-12 16:41:46 +01:00
d0d986dd0e bugfix of bugfix (thx to Sander) 2007-02-12 14:20:47 +01:00
9685e7dbc2 fixed a bug 2007-02-12 13:04:29 +01:00
37f39afb8e during writing 2wm.1 I noticed some bugs in dwm.1 2007-02-12 11:42:32 +01:00
dc9f62f393 removing all EnterNotifys after resize 2007-02-12 10:21:26 +01:00
7055315725 added pointer warp on drop in resize 2007-02-12 10:19:52 +01:00
fd995dac78 pneubeck pointed out an obvious thing, that a second p = stext + strlen(stext) - 1 is unnecessary 2007-02-09 14:56:19 +01:00
e5765cdd84 treating acroread and mplayer floating by default 2007-02-09 11:58:37 +01:00
8d0e58f80b adapting John Grahor's patch to dwm-3.5 2007-02-09 09:54:08 +01:00
8fcd1bfda8 fixed copyright notice in Makefile 2007-02-08 14:09:52 +01:00
e39e697998 fixed order of Bool declarations 2007-02-08 13:39:33 +01:00
d2dd58eabd added TOPBAR option for making the bar appear what the user likes 2007-02-08 11:48:01 +01:00
c6fc6b173d next version is 3.5 2007-02-08 11:11:15 +01:00
4590d7877c making the bar appear at bottom 2007-02-08 11:08:40 +01:00
f577fe4e27 Added tag 3.4 for changeset 9ede7b2d2450 2007-02-07 12:42:35 +01:00
11 changed files with 75 additions and 78 deletions

View File

@ -35,3 +35,4 @@ e1c8bef05e6e48df4f26471ea0712aa43ab9d949 3.1
f2cabc83a18f9b5b548159329ddd4dee904fa31f 3.2.1
d3876aa792923f9a95f7ad0c7f0134533404df35 3.2.2
0f91934037b04221ff5d1ba3a6c39c1ff26e3661 3.3
9ede7b2d2450537e750d5505789fbe63960e97e6 3.4

View File

@ -1,5 +1,5 @@
# dwm - dynamic window manager
# (C)opyright MMVII Anselm R. Garbe
# (C)opyright MMVI-MMVII Anselm R. Garbe
include config.mk

View File

@ -69,19 +69,20 @@ xerrordummy(Display *dsply, XErrorEvent *ee) {
void
configure(Client *c) {
XEvent synev;
XConfigureEvent ce;
synev.type = ConfigureNotify;
synev.xconfigure.display = dpy;
synev.xconfigure.event = c->win;
synev.xconfigure.window = c->win;
synev.xconfigure.x = c->x;
synev.xconfigure.y = c->y;
synev.xconfigure.width = c->w;
synev.xconfigure.height = c->h;
synev.xconfigure.border_width = c->border;
synev.xconfigure.above = None;
XSendEvent(dpy, c->win, True, NoEventMask, &synev);
ce.type = ConfigureNotify;
ce.display = dpy;
ce.event = c->win;
ce.window = c->win;
ce.x = c->x;
ce.y = c->y;
ce.width = c->w;
ce.height = c->h;
ce.border_width = c->border;
ce.above = None;
ce.override_redirect = False;
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
}
void
@ -147,7 +148,7 @@ killclient(Arg *arg) {
void
manage(Window w, XWindowAttributes *wa) {
Client *c;
Client *c, *t;
Window trans;
c = emallocz(sizeof(Client));
@ -180,9 +181,10 @@ manage(Window w, XWindowAttributes *wa) {
grabbuttons(c, False);
XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
updatetitle(c);
settags(c, getclient(trans));
t = getclient(trans);
settags(c, t);
if(!c->isfloat)
c->isfloat = trans || c->isfixed;
c->isfloat = (t != 0) || c->isfixed;
if(clients)
clients->prev = c;
c->next = clients;
@ -302,8 +304,8 @@ updatesizehints(Client *c) {
}
else
c->minax = c->minay = c->maxax = c->maxay = 0;
c->isfixed = (c->maxw && c->minw && c->maxh && c->minh &&
c->maxw == c->minw && c->maxh == c->minh);
c->isfixed = (c->maxw && c->minw && c->maxh && c->minh
&& c->maxw == c->minw && c->maxh == c->minh);
}
void
@ -323,7 +325,7 @@ updatetitle(Client *c) {
strncpy(c->name, (char *)name.value, sizeof c->name);
else {
if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
&& n > 0 && *list)
&& n > 0 && *list)
{
strncpy(c->name, *list, sizeof c->name);
XFreeStringList(list);

View File

@ -22,6 +22,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
#define MODKEY Mod1Mask
#define NMASTER 1 /* clients in master area */
#define SNAP 40 /* pixel */
#define TOPBAR True /* False */
#define KEYS \
static Key key[] = { \
@ -86,8 +87,8 @@ static Key key[] = { \
#define RULES \
static Rule rule[] = { \
/* class:instance:title regex tags regex isfloat */ \
{ "Firefox.*", "3", False }, \
{ "Gimp.*", NULL, True }, \
{ "MPlayer.*", NULL, True }, \
{ "Acroread.*", NULL, True }, \
{ "Firefox", "3", False }, \
{ "Gimp", NULL, True }, \
{ "MPlayer", NULL, True }, \
{ "Acroread", NULL, True }, \
};

View File

@ -22,6 +22,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
#define MODKEY Mod1Mask
#define NMASTER 1 /* clients in master area */
#define SNAP 20 /* pixel */
#define TOPBAR True /* False */
#define KEYS \
static Key key[] = { \
@ -83,5 +84,7 @@ static Key key[] = { \
#define RULES \
static Rule rule[] = { \
/* class:instance:title regex tags regex isfloat */ \
{ "Gimp.*", NULL, True }, \
{ "Gimp", NULL, True }, \
{ "MPlayer", NULL, True }, \
{ "Acroread", NULL, True }, \
};

View File

@ -1,5 +1,5 @@
# dwm version
VERSION = 3.4
VERSION = 3.5
# Customize below to fit your system

4
dwm.1
View File

@ -67,7 +67,7 @@ Focus next window.
Focus previous window.
.TP
.B Mod1-Return
Zooms/cycles current window to/from master area (tiling mode), toggles maximization current window (floating mode).
Zooms/cycles current window to/from master area (tiling mode), toggles maximization of current window (floating mode).
.TP
.B Mod1-g
Grow master area (tiling mode only).
@ -124,7 +124,7 @@ Quit dwm.
Move current window while dragging (floating mode only).
.TP
.B Mod1-Button2
Zoom current window to the master area (tiling mode only).
Zooms/cycles current window to/from master area (tiling mode), toggles maximization of current window (floating mode).
.TP
.B Mod1-Button3
Resize current window while dragging (floating mode only).

54
event.c
View File

@ -82,7 +82,10 @@ resizemouse(Client *c) {
switch(ev.type) {
case ButtonRelease:
resize(c, True);
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0,
c->w + c->border - 1, c->h + c->border - 1);
XUngrabPointer(dpy, CurrentTime);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
return;
case ConfigureRequest:
case Expose:
@ -153,8 +156,9 @@ buttonpress(XEvent *e) {
}
else if(ev->button == Button2)
zoom(NULL);
else if(ev->button == Button3 && (arrange == dofloat || c->isfloat) &&
!c->isfixed) {
else if(ev->button == Button3
&& (arrange == dofloat || c->isfloat) && !c->isfixed)
{
restack();
resizemouse(c);
}
@ -163,40 +167,32 @@ buttonpress(XEvent *e) {
static void
configurerequest(XEvent *e) {
unsigned long newmask;
Client *c;
XConfigureRequestEvent *ev = &e->xconfigurerequest;
XWindowChanges wc;
if((c = getclient(ev->window))) {
c->ismax = False;
if(ev->value_mask & CWX)
c->x = ev->x;
if(ev->value_mask & CWY)
c->y = ev->y;
if(ev->value_mask & CWWidth)
c->w = ev->width;
if(ev->value_mask & CWHeight)
c->h = ev->height;
if(ev->value_mask & CWBorderWidth)
c->border = ev->border_width;
wc.x = c->x;
wc.y = c->y;
wc.width = c->w;
wc.height = c->h;
newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth));
if(newmask)
XConfigureWindow(dpy, c->win, newmask, &wc);
else
configure(c);
XSync(dpy, False);
if(c->isfloat) {
if(c->isfixed || c->isfloat || (arrange == dofloat)) {
if(ev->value_mask & CWX)
c->x = ev->x;
if(ev->value_mask & CWY)
c->y = ev->y;
if(ev->value_mask & CWWidth)
c->w = ev->width;
if(ev->value_mask & CWHeight)
c->h = ev->height;
if((ev->value_mask & (CWX | CWY))
&& !(ev->value_mask & (CWWidth | CWHeight)))
configure(c);
resize(c, False);
if(!isvisible(c))
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
}
else
arrange();
configure(c);
}
else {
wc.x = ev->x;
@ -207,8 +203,8 @@ configurerequest(XEvent *e) {
wc.sibling = ev->above;
wc.stack_mode = ev->detail;
XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
XSync(dpy, False);
}
XSync(dpy, False);
}
static void
@ -254,14 +250,13 @@ keypress(XEvent *e) {
XKeyEvent *ev = &e->xkey;
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
for(i = 0; i < len; i++) {
for(i = 0; i < len; i++)
if(keysym == key[i].keysym
&& CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
&& CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
{
if(key[i].func)
key[i].func(&key[i].arg);
}
}
}
static void
@ -290,11 +285,8 @@ maprequest(XEvent *e) {
if(!XGetWindowAttributes(dpy, ev->window, &wa))
return;
if(wa.override_redirect) {
XSelectInput(dpy, ev->window,
(StructureNotifyMask | PropertyChangeMask));
if(wa.override_redirect)
return;
}
if(!getclient(ev->window))
manage(ev->window, &wa);
}

21
main.c
View File

@ -18,11 +18,11 @@
/* extern */
char stext[256];
Bool *seltag;
int bh, bmw, screen, sx, sy, sw, sh, wax, way, waw, wah;
unsigned int master, nmaster, ntags, numlockmask;
Atom wmatom[WMLast], netatom[NetLast];
Bool running = True;
Bool *seltag;
Bool selscreen = True;
Client *clients = NULL;
Client *sel = NULL;
@ -69,9 +69,8 @@ scan(void) {
wins = NULL;
if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) {
for(i = 0; i < num; i++) {
if(!XGetWindowAttributes(dpy, wins[i], &wa))
continue;
if(wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1))
if(!XGetWindowAttributes(dpy, wins[i], &wa)
|| wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1))
continue;
if(wa.map_state == IsViewable)
manage(wins[i], &wa);
@ -104,12 +103,12 @@ setup(void) {
/* init modifier map */
numlockmask = 0;
modmap = XGetModifierMapping(dpy);
for (i = 0; i < 8; i++) {
for (i = 0; i < 8; i++)
for (j = 0; j < modmap->max_keypermod; j++) {
if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock))
if(modmap->modifiermap[i * modmap->max_keypermod + j]
== XKeysymToKeycode(dpy, XK_Num_Lock))
numlockmask = (1 << i);
}
}
XFreeModifiermap(modmap);
/* select for events */
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
@ -141,15 +140,15 @@ setup(void) {
wa.override_redirect = 1;
wa.background_pixmap = ParentRelative;
wa.event_mask = ButtonPressMask | ExposureMask;
barwin = XCreateWindow(dpy, root, sx, sy, sw, bh, 0, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen),
barwin = XCreateWindow(dpy, root, sx, sy + (TOPBAR ? 0 : sh - bh), sw, bh, 0,
DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
XDefineCursor(dpy, barwin, cursor[CurNormal]);
XMapRaised(dpy, barwin);
strcpy(stext, "dwm-"VERSION);
/* windowarea */
wax = sx;
way = sy + bh;
way = sy + (TOPBAR ? bh : 0);
wah = sh - bh;
waw = sw;
/* pixmap for everything */
@ -273,7 +272,7 @@ main(int argc, char *argv[]) {
break;
default:
for(stext[r] = '\0', p = stext + strlen(stext) - 1; p >= stext && *p == '\n'; *p-- = '\0');
for(p = stext + strlen(stext) - 1; p >= stext && *p != '\n'; --p);
for(; p >= stext && *p != '\n'; --p);
if(p > stext)
strncpy(stext, p + 1, sizeof stext);
}

8
tag.c
View File

@ -76,13 +76,13 @@ settags(Client *c, Client *trans) {
unsigned int i, j;
regmatch_t tmp;
Bool matched = trans != NULL;
XClassHint ch;
XClassHint ch = { 0 };
if(matched) {
if(matched)
for(i = 0; i < ntags; i++)
c->tags[i] = trans->tags[i];
}
else if(XGetClassHint(dpy, c->win, &ch)) {
else {
XGetClassHint(dpy, c->win, &ch);
snprintf(prop, sizeof prop, "%s:%s:%s",
ch.res_class ? ch.res_class : "",
ch.res_name ? ch.res_name : "", c->name);

9
view.c
View File

@ -55,9 +55,8 @@ dofloat(void) {
Client *c;
for(c = clients; c; c = c->next) {
if(isvisible(c)) {
if(isvisible(c))
resize(c, True);
}
else
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
}
@ -150,7 +149,7 @@ focusprev(Arg *arg) {
void
incnmaster(Arg *arg) {
if((arrange == dofloat) || (nmaster + arg->i < 1)
|| (wah / (nmaster + arg->i) <= 2 * BORDERPX))
|| (wah / (nmaster + arg->i) <= 2 * BORDERPX))
return;
nmaster += arg->i;
if(sel)
@ -175,7 +174,7 @@ resizemaster(Arg *arg) {
master = MASTER;
else {
if(waw * (master + arg->i) / 1000 >= waw - 2 * BORDERPX
|| waw * (master + arg->i) / 1000 <= 2 * BORDERPX)
|| waw * (master + arg->i) / 1000 <= 2 * BORDERPX)
return;
master += arg->i;
}
@ -207,7 +206,7 @@ restack(void) {
void
togglefloat(Arg *arg) {
if (!sel || arrange == dofloat)
if(!sel || arrange == dofloat)
return;
sel->isfloat = !sel->isfloat;
arrange();