Compare commits

...

21 Commits
3.1 ... 3.2.1

Author SHA1 Message Date
55be4d6137 hotfix release 3.2.1 2007-01-24 17:25:30 +01:00
1f18466409 applied offscreen appearance hotfix 2007-01-24 17:24:55 +01:00
b65a1e3379 Added tag 3.2 for changeset 4ce65f61f01b 2007-01-24 12:12:29 +01:00
87836d79ef renamed activescreen into selscreen 2007-01-23 17:12:15 +01:00
c8a12a0852 implemented Sanders remarks 2007-01-23 13:10:35 +01:00
71b84c2114 small changes 2007-01-23 12:29:17 +01:00
edb2660a2e removed a blank line 2007-01-23 12:04:22 +01:00
17ec726b49 this version should also work with cornercases (like unmanage during !issel, etc.) 2007-01-23 12:00:49 +01:00
373b11de11 I think this is the best solution of multihead support 2007-01-23 11:49:16 +01:00
04a2b74529 darker border 2007-01-22 16:02:37 +01:00
fcd98308ba this variant is known to work, but focus() is ugly - we need in general a better way to handle multihead, this issel-stuff looks awkward (maybe it might be a good idea to set sel to NULL but to introduce a Client *revert which is set if a screen is unfocused, have to think about it further). 2007-01-22 10:35:58 +01:00
b233089815 applied Sanders all5.patch (thanks for your weekend session, Sander!) 2007-01-22 10:22:58 +01:00
201c56f6d3 leavenotify also don't needs the check 2007-01-19 15:05:07 +01:00
1e051d71f5 deciding for focus(NULL); 2007-01-19 15:01:51 +01:00
ddc79603f9 replaced XSetBorder.../focus() 2007-01-19 14:38:09 +01:00
dee5ea2335 yet another multihead fix by Christof Musik 2007-01-19 14:36:25 +01:00
b1c9f5f144 I prefer BORDERPX=1 2007-01-19 08:05:39 +01:00
a542bdf658 personally I prefer 2px borders 2007-01-18 11:46:39 +01:00
96e1b25c8c applied a modified version of Christof Musik's multihead patch (though this is not sure if it works in all cases, have to wait for an ACK by Christof) 2007-01-18 11:11:40 +01:00
caf5a16271 moved BORDERPX to config.*.h 2007-01-17 12:36:29 +01:00
936e11fd54 Added tag 3.1 for changeset e1c8bef05e6e 2007-01-16 11:41:56 +01:00
10 changed files with 84 additions and 85 deletions

View File

@ -30,3 +30,5 @@ c7f84f23ec5aef29988dcdc4ec22a7352ee8f58e 2.5.1
107719a9ce3bd0c79f9f1f626596eb338a276561 2.8
3a5910fac3ccb522a98aeeba7af7008530b25092 2.9
76b58d21ea98257c05565a3b9c850b9b26a32968 3.0
e1c8bef05e6e48df4f26471ea0712aa43ab9d949 3.1
4ce65f61f01b055fa6c2901c6d2527ef741aa4bf 3.2

View File

@ -79,31 +79,28 @@ configure(Client *c) {
void
focus(Client *c) {
Client *old;
if(!issel || (c && !isvisible(c)))
if(c && !isvisible(c))
return;
if(!sel)
sel = c;
else if(sel != c) {
old = sel;
sel = c;
if(old) {
grabbuttons(old, False);
XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]);
}
if(sel && sel != c) {
grabbuttons(sel, False);
XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
}
if(c) {
detachstack(c);
c->snext = stack;
stack = c;
grabbuttons(c, True);
}
sel = c;
drawstatus();
if(!selscreen)
return;
if(c) {
XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
}
else
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
drawstatus();
}
Client *
@ -134,25 +131,33 @@ manage(Window w, XWindowAttributes *wa) {
c = emallocz(sizeof(Client));
c->tags = emallocz(ntags * sizeof(Bool));
c->win = w;
c->border = 0;
c->x = wa->x;
c->y = wa->y;
c->w = wa->width;
c->h = wa->height;
updatesizehints(c);
if(c->x + c->w + 2 * BORDERPX > sw)
c->x = sw - c->w - 2 * BORDERPX;
if(c->x < sx)
if(c->w == sw && c->h == sh) {
c->border = 0;
c->x = sx;
if(c->y + c->h + 2 * BORDERPX > sh)
c->y = sh - c->h - 2 * BORDERPX;
if(c->h != sh && c->y < bh)
c->y = bh;
c->y = sy;
}
else {
c->border = BORDERPX;
if(c->x + c->w + 2 * c->border > wax + waw)
c->x = wax + waw - c->w - 2 * c->border;
if(c->y + c->h + 2 * c->border > way + wah)
c->y = way + wah - c->h - 2 * c->border;
if(c->x < wax)
c->x = wax;
if(c->y < way)
c->y = way;
}
updatesizehints(c);
c->proto = getproto(c->win);
XSelectInput(dpy, c->win,
StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
XGetTransientForHint(dpy, c->win, &trans);
grabbuttons(c, False);
XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
updatetitle(c);
settags(c, getclient(trans));
if(!c->isfloat)
@ -170,9 +175,7 @@ manage(Window w, XWindowAttributes *wa) {
}
void
resize(Client *c, Bool sizehints, Corner sticky) {
int bottom = c->y + c->h;
int right = c->x + c->w;
resize(Client *c, Bool sizehints) {
XWindowChanges wc;
if(sizehints) {
@ -189,27 +192,24 @@ resize(Client *c, Bool sizehints, Corner sticky) {
if(c->maxh && c->h > c->maxh)
c->h = c->maxh;
}
if(sticky == TopRight || sticky == BotRight)
c->x = right - c->w;
if(sticky == BotLeft || sticky == BotRight)
c->y = bottom - c->h;
if(c->w == sw && c->h == sh)
c->border = 0;
else
c->border = BORDERPX;
/* offscreen appearance fixes */
if(c->x + c->w < sx)
c->x = sx;
if(c->y + c->h < bh)
c->y = bh;
if(c->x > sw)
c->x = sw - c->w;
c->x = sw - c->w - 2 * c->border;
if(c->y > sh)
c->y = sh - c->h;
c->y = sh - c->h - 2 * c->border;
if(c->x + c->w + 2 * c->border < sx)
c->x = sx;
if(c->y + c->h + 2 * c->border < sy)
c->y = sy;
wc.x = c->x;
wc.y = c->y;
wc.width = c->w;
wc.height = c->h;
if(c->w == sw && c->h == sh)
wc.border_width = 0;
else
wc.border_width = BORDERPX;
wc.border_width = c->border;
XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc);
configure(c);
XSync(dpy, False);

View File

@ -5,6 +5,7 @@
#define TAGS \
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
#define BORDERPX 1
#define DEFMODE dotile /* dofloat */
#define FLOATSYMBOL "><>"
#define TILESYMBOL "[]="
@ -13,7 +14,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
#define NORMBORDERCOLOR "#333"
#define NORMBGCOLOR "#222"
#define NORMFGCOLOR "#ccc"
#define SELBORDERCOLOR "#9cf"
#define SELBORDERCOLOR "#69c"
#define SELBGCOLOR "#555"
#define SELFGCOLOR "#fff"

View File

@ -5,6 +5,7 @@
#define TAGS \
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
#define BORDERPX 1
#define DEFMODE dotile /* dofloat */
#define FLOATSYMBOL "><>"
#define TILESYMBOL "[]="

View File

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

2
dwm.1
View File

@ -25,7 +25,7 @@ window are indicated with a filled square in the top left corner. The tags
which are applied to one or more windows are indicated with an empty square in
the top left corner.
.P
dwm draws a 1-pixel border around windows to indicate the focus state.
dwm draws a small border around windows to indicate the focus state.
.SH OPTIONS
.TP
.B \-v

9
dwm.h
View File

@ -37,7 +37,6 @@
/* mask shorthands, used in event.c and client.c */
#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
/* other stuff used in different places */
#define BORDERPX 1
#define PROTODELWIN 1
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
@ -45,10 +44,6 @@ enum { WMProtocols, WMDelete, WMLast }; /* default atoms */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
typedef enum {
TopLeft, TopRight, BotLeft, BotRight
} Corner; /* window corners */
typedef union {
const char *cmd;
int i;
@ -98,7 +93,7 @@ extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */
extern void (*handler[LASTEvent])(XEvent *); /* event handler */
extern void (*arrange)(void); /* arrange function, indicates mode */
extern Atom wmatom[WMLast], netatom[NetLast];
extern Bool running, issel, *seltag; /* seltag is array of Bool */
extern Bool running, selscreen, *seltag; /* seltag is array of Bool */
extern Client *clients, *sel, *stack; /* global client list and stack */
extern Cursor cursor[CurLast];
extern DC dc; /* global draw context */
@ -111,7 +106,7 @@ extern void focus(Client *c); /* focus c, c may be NULL */
extern Client *getclient(Window w); /* return client of w */
extern void killclient(Arg *arg); /* kill c nicely */
extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
extern void resize(Client *c, Bool sizehints); /* resize c*/
extern void updatesizehints(Client *c); /* update the size hint variables of c */
extern void updatetitle(Client *c); /* update the name of c */
extern void unmanage(Client *c); /* destroy c */

58
event.c
View File

@ -35,14 +35,16 @@ movemouse(Client *c) {
c->ismax = False;
XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
for(;;) {
XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev);
XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask, &ev);
switch (ev.type) {
case ButtonRelease:
resize(c, True, TopLeft);
resize(c, True);
XUngrabPointer(dpy, CurrentTime);
return;
case ConfigureRequest:
case Expose:
handler[Expose](&ev);
case MapRequest:
handler[ev.type](&ev);
break;
case MotionNotify:
XSync(dpy, False);
@ -50,13 +52,13 @@ movemouse(Client *c) {
c->y = ocy + (ev.xmotion.y - y1);
if(abs(wax + c->x) < SNAP)
c->x = wax;
else if(abs((wax + waw) - (c->x + c->w)) < SNAP)
c->x = wax + waw - c->w - 2 * BORDERPX;
else if(abs((wax + waw) - (c->x + c->w + 2 * c->border)) < SNAP)
c->x = wax + waw - c->w - 2 * c->border;
if(abs(way - c->y) < SNAP)
c->y = way;
else if(abs((way + wah) - (c->y + c->h)) < SNAP)
c->y = way + wah - c->h - 2 * BORDERPX;
resize(c, False, TopLeft);
else if(abs((way + wah) - (c->y + c->h + 2 * c->border)) < SNAP)
c->y = way + wah - c->h - 2 * c->border;
resize(c, False);
break;
}
}
@ -66,7 +68,6 @@ static void
resizemouse(Client *c) {
int ocx, ocy;
int nw, nh;
Corner sticky;
XEvent ev;
ocx = c->x;
@ -75,30 +76,26 @@ resizemouse(Client *c) {
None, cursor[CurResize], CurrentTime) != GrabSuccess)
return;
c->ismax = False;
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h);
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->border - 1, c->h + c->border - 1);
for(;;) {
XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev);
XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask , &ev);
switch(ev.type) {
case ButtonRelease:
resize(c, True, TopLeft);
resize(c, True);
XUngrabPointer(dpy, CurrentTime);
return;
case ConfigureRequest:
case Expose:
handler[Expose](&ev);
case MapRequest:
handler[ev.type](&ev);
break;
case MotionNotify:
XSync(dpy, False);
if((nw = abs(ocx - ev.xmotion.x)))
c->w = nw;
if((nh = abs(ocy - ev.xmotion.y)))
c->h = nh;
c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - c->w;
c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - c->h;
if(ocx <= ev.xmotion.x)
sticky = (ocy <= ev.xmotion.y) ? TopLeft : BotLeft;
else
sticky = (ocy <= ev.xmotion.y) ? TopRight : BotRight;
resize(c, True, sticky);
nw = ev.xmotion.x - ocx - 2 * c->border + 1;
c->w = nw > 0 ? nw : 1;
nh = ev.xmotion.y - ocy - 2 * c->border + 1;
c->h = nh > 0 ? nh : 1;
resize(c, True);
break;
}
}
@ -194,7 +191,7 @@ configurerequest(XEvent *e) {
configure(c);
XSync(dpy, False);
if(c->isfloat) {
resize(c, False, TopLeft);
resize(c, False);
if(!isvisible(c))
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
}
@ -233,8 +230,9 @@ enternotify(XEvent *e) {
if((c = getclient(ev->window)) && isvisible(c))
focus(c);
else if(ev->window == root) {
issel = True;
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
selscreen = True;
for(c = stack; c && !isvisible(c); c = c->snext);
focus(c);
}
}
@ -270,8 +268,10 @@ static void
leavenotify(XEvent *e) {
XCrossingEvent *ev = &e->xcrossing;
if((ev->window == root) && !ev->same_screen)
issel = False;
if((ev->window == root) && !ev->same_screen) {
selscreen = False;
focus(NULL);
}
}
static void

6
main.c
View File

@ -23,7 +23,7 @@ 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 issel = True;
Bool selscreen = True;
Client *clients = NULL;
Client *sel = NULL;
Client *stack = NULL;
@ -41,7 +41,7 @@ static void
cleanup(void) {
close(STDIN_FILENO);
while(stack) {
resize(stack, True, TopLeft);
resize(stack, True);
unmanage(stack);
}
if(dc.font.set)
@ -156,7 +156,7 @@ setup(void) {
dc.gc = XCreateGC(dpy, root, 0, 0);
XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
/* multihead support */
issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
selscreen = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
}
/*

8
view.c
View File

@ -31,7 +31,7 @@ togglemax(Client *c) {
c->w = c->rw;
c->h = c->rh;
}
resize(c, True, TopLeft);
resize(c, True);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
@ -56,7 +56,7 @@ dofloat(void) {
for(c = clients; c; c = c->next) {
if(isvisible(c)) {
resize(c, True, TopLeft);
resize(c, True);
}
else
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
@ -84,7 +84,7 @@ dotile(void) {
for(i = 0, c = clients; c; c = c->next)
if(isvisible(c)) {
if(c->isfloat) {
resize(c, True, TopLeft);
resize(c, True);
continue;
}
c->ismax = False;
@ -105,7 +105,7 @@ dotile(void) {
else /* fallback if th < bh */
c->h = wah - 2 * BORDERPX;
}
resize(c, False, TopLeft);
resize(c, False);
i++;
}
else