Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
c31648d15d | |||
52250e7c1e | |||
51a94a2f14 | |||
c95bf3db9d | |||
4bf3b01953 | |||
ff957d1eac | |||
83aa110c6f | |||
5a1a2edf0e | |||
b3419f49a3 | |||
141beb2704 | |||
4e49d5a0ad |
1
.hgtags
1
.hgtags
@ -44,3 +44,4 @@ baee494346e520f8dee2cee9491b8350064770d2 3.7
|
||||
55478328b2422c700c5404a774c85e77322f41a3 3.9
|
||||
018c3846842291cb6c009dc087e7fe2f0ef53bea 4.0
|
||||
00f4180df72b49aadb2933804fde4bfb33e5666d 4.1
|
||||
c13cb8c6b7a56af74cc88346e71d2490470b546f 4.2
|
||||
|
65
client.c
65
client.c
@ -96,6 +96,14 @@ attach(Client *c) {
|
||||
clients = c;
|
||||
}
|
||||
|
||||
void
|
||||
ban(Client *c) {
|
||||
if (c->isbanned)
|
||||
return;
|
||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
||||
c->isbanned = True;
|
||||
}
|
||||
|
||||
void
|
||||
configure(Client *c) {
|
||||
XConfigureEvent ce;
|
||||
@ -216,8 +224,7 @@ manage(Window w, XWindowAttributes *wa) {
|
||||
c->isfloating = (rettrans == Success) || c->isfixed;
|
||||
attach(c);
|
||||
attachstack(c);
|
||||
c->isbanned = True;
|
||||
XMoveWindow(dpy, w, c->x + 2 * sw, c->y);
|
||||
ban(c);
|
||||
XMapWindow(dpy, w);
|
||||
setclientstate(c, NormalState);
|
||||
focus(c);
|
||||
@ -299,6 +306,37 @@ togglefloating(const char *arg) {
|
||||
lt->arrange();
|
||||
}
|
||||
|
||||
void
|
||||
unban(Client *c) {
|
||||
if (!c->isbanned)
|
||||
return;
|
||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||
c->isbanned = False;
|
||||
}
|
||||
|
||||
void
|
||||
unmanage(Client *c) {
|
||||
XWindowChanges wc;
|
||||
|
||||
wc.border_width = c->oldborder;
|
||||
/* The server grab construct avoids race conditions. */
|
||||
XGrabServer(dpy);
|
||||
XSetErrorHandler(xerrordummy);
|
||||
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
|
||||
detach(c);
|
||||
detachstack(c);
|
||||
if(sel == c)
|
||||
focus(NULL);
|
||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||
setclientstate(c, WithdrawnState);
|
||||
free(c->tags);
|
||||
free(c);
|
||||
XSync(dpy, False);
|
||||
XSetErrorHandler(xerror);
|
||||
XUngrabServer(dpy);
|
||||
lt->arrange();
|
||||
}
|
||||
|
||||
void
|
||||
updatesizehints(Client *c) {
|
||||
long msize;
|
||||
@ -377,26 +415,3 @@ updatetitle(Client *c) {
|
||||
c->name[sizeof c->name - 1] = '\0';
|
||||
XFree(name.value);
|
||||
}
|
||||
|
||||
void
|
||||
unmanage(Client *c) {
|
||||
XWindowChanges wc;
|
||||
|
||||
wc.border_width = c->oldborder;
|
||||
/* The server grab construct avoids race conditions. */
|
||||
XGrabServer(dpy);
|
||||
XSetErrorHandler(xerrordummy);
|
||||
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
|
||||
detach(c);
|
||||
detachstack(c);
|
||||
if(sel == c)
|
||||
focus(NULL);
|
||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||
setclientstate(c, WithdrawnState);
|
||||
free(c->tags);
|
||||
free(c);
|
||||
XSync(dpy, False);
|
||||
XSetErrorHandler(xerror);
|
||||
XUngrabServer(dpy);
|
||||
lt->arrange();
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
/* appearance */
|
||||
#define BARPOS BarTop /* BarBot, BarOff */
|
||||
#define BORDERPX 1
|
||||
#define FONT "-*-pixelcarnage monospace-*-r-*-*-14-*-*-*-*-*-*-*"
|
||||
#define FONT "-*-terminus-medium-r-*-*-14-*-*-*-*-*-iso10646-*"
|
||||
#define NORMBORDERCOLOR "#333"
|
||||
#define NORMBGCOLOR "#222"
|
||||
#define NORMFGCOLOR "#ccc"
|
||||
|
@ -1,5 +1,5 @@
|
||||
# dwm version
|
||||
VERSION = 4.2
|
||||
VERSION = 4.3
|
||||
|
||||
# Customize below to fit your system
|
||||
|
||||
|
32
dwm.h
32
dwm.h
@ -79,23 +79,24 @@ typedef struct {
|
||||
} Layout;
|
||||
|
||||
extern const char *tags[]; /* all tags */
|
||||
char stext[256]; /* status text */
|
||||
int screen, sx, sy, sw, sh; /* screen geometry */
|
||||
int wax, way, wah, waw; /* windowarea geometry */
|
||||
unsigned int bh, blw, bpos; /* bar height, bar layout label width, bar position */
|
||||
unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */
|
||||
void (*handler[LASTEvent])(XEvent *); /* event handler */
|
||||
Atom wmatom[WMLast], netatom[NetLast];
|
||||
Bool selscreen, *seltag; /* seltag is array of Bool */
|
||||
Client *clients, *sel, *stack; /* global client list and stack */
|
||||
Cursor cursor[CurLast];
|
||||
DC dc; /* global draw context */
|
||||
Display *dpy;
|
||||
Layout *lt;
|
||||
Window root, barwin;
|
||||
extern char stext[256]; /* status text */
|
||||
extern int screen, sx, sy, sw, sh; /* screen geometry */
|
||||
extern int wax, way, wah, waw; /* windowarea geometry */
|
||||
extern unsigned int bh, blw, bpos; /* bar height, bar layout label width, bar position */
|
||||
extern unsigned int ntags, numlockmask; /* number of tags, numlock mask */
|
||||
extern void (*handler[LASTEvent])(XEvent *); /* event handler */
|
||||
extern Atom wmatom[WMLast], netatom[NetLast];
|
||||
extern Bool 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 */
|
||||
extern Display *dpy;
|
||||
extern Layout *lt;
|
||||
extern Window root, barwin;
|
||||
|
||||
/* client.c */
|
||||
void attach(Client *c); /* attaches c to global client list */
|
||||
void ban(Client *c); /* bans c */
|
||||
void configure(Client *c); /* send synthetic configure event */
|
||||
void detach(Client *c); /* detaches c from global client list */
|
||||
void focus(Client *c); /* focus c if visible && !NULL, or focus top visible */
|
||||
@ -104,9 +105,10 @@ void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
||||
void resize(Client *c, int x, int y,
|
||||
int w, int h, Bool sizehints); /* resize with given coordinates c*/
|
||||
void togglefloating(const char *arg); /* toggles sel between floating/tiled state */
|
||||
void unban(Client *c); /* unbans c */
|
||||
void unmanage(Client *c); /* destroy c */
|
||||
void updatesizehints(Client *c); /* update the size hint variables of c */
|
||||
void updatetitle(Client *c); /* update the name of c */
|
||||
void unmanage(Client *c); /* destroy c */
|
||||
|
||||
/* draw.c */
|
||||
void drawstatus(void); /* draw the bar */
|
||||
|
34
layout.c
34
layout.c
@ -11,22 +11,6 @@ static unsigned int nlayouts = 0;
|
||||
static unsigned int masterw = MASTERWIDTH;
|
||||
static unsigned int nmaster = NMASTER;
|
||||
|
||||
static void
|
||||
ban(Client *c) {
|
||||
if (c->isbanned)
|
||||
return;
|
||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
||||
c->isbanned = True;
|
||||
}
|
||||
|
||||
static void
|
||||
unban(Client *c) {
|
||||
if (!c->isbanned)
|
||||
return;
|
||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||
c->isbanned = False;
|
||||
}
|
||||
|
||||
static void
|
||||
tile(void) {
|
||||
unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
|
||||
@ -88,9 +72,7 @@ floating(void) {
|
||||
|
||||
for(c = clients; c; c = c->next)
|
||||
if(isvisible(c)) {
|
||||
if(c->isbanned)
|
||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||
c->isbanned = False;
|
||||
unban(c);
|
||||
resize(c, c->x, c->y, c->w, c->h, True);
|
||||
}
|
||||
else
|
||||
@ -182,6 +164,7 @@ void
|
||||
restack(void) {
|
||||
Client *c;
|
||||
XEvent ev;
|
||||
XWindowChanges wc;
|
||||
|
||||
drawstatus();
|
||||
if(!sel)
|
||||
@ -189,12 +172,17 @@ restack(void) {
|
||||
if(sel->isfloating || lt->arrange == floating)
|
||||
XRaiseWindow(dpy, sel->win);
|
||||
if(lt->arrange != floating) {
|
||||
if(!sel->isfloating)
|
||||
XLowerWindow(dpy, sel->win);
|
||||
wc.stack_mode = Below;
|
||||
wc.sibling = barwin;
|
||||
if(!sel->isfloating) {
|
||||
XConfigureWindow(dpy, sel->win, CWSibling | CWStackMode, &wc);
|
||||
wc.sibling = sel->win;
|
||||
}
|
||||
for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
|
||||
if(c == sel)
|
||||
continue;
|
||||
XLowerWindow(dpy, c->win);
|
||||
XConfigureWindow(dpy, c->win, CWSibling | CWStackMode, &wc);
|
||||
wc.sibling = c->win;
|
||||
}
|
||||
}
|
||||
XSync(dpy, False);
|
||||
@ -243,7 +231,7 @@ togglemax(const char *arg) {
|
||||
sel->ry = sel->y;
|
||||
sel->rw = sel->w;
|
||||
sel->rh = sel->h;
|
||||
resize(sel, wax, way, waw - 2 * BORDERPX, wah - 2 * BORDERPX, True);
|
||||
resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True);
|
||||
}
|
||||
else
|
||||
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
|
||||
|
9
main.c
9
main.c
@ -16,7 +16,9 @@
|
||||
|
||||
char stext[256];
|
||||
int screen, sx, sy, sw, sh, wax, way, waw, wah;
|
||||
unsigned int bh, bpos, ntags, numlockmask;
|
||||
unsigned int bh, ntags;
|
||||
unsigned int bpos = BARPOS;
|
||||
unsigned int numlockmask = 0;
|
||||
Atom wmatom[WMLast], netatom[NetLast];
|
||||
Bool *seltag;
|
||||
Bool selscreen = True;
|
||||
@ -38,8 +40,7 @@ static void
|
||||
cleanup(void) {
|
||||
close(STDIN_FILENO);
|
||||
while(stack) {
|
||||
if(stack->isbanned)
|
||||
XMoveWindow(dpy, stack->win, stack->x, stack->y);
|
||||
unban(stack);
|
||||
unmanage(stack);
|
||||
}
|
||||
if(dc.font.set)
|
||||
@ -150,7 +151,6 @@ setup(void) {
|
||||
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
|
||||
cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
|
||||
/* init modifier map */
|
||||
numlockmask = 0;
|
||||
modmap = XGetModifierMapping(dpy);
|
||||
for (i = 0; i < 8; i++)
|
||||
for (j = 0; j < modmap->max_keypermod; j++) {
|
||||
@ -192,7 +192,6 @@ setup(void) {
|
||||
DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
|
||||
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
||||
XDefineCursor(dpy, barwin, cursor[CurNormal]);
|
||||
bpos = BARPOS;
|
||||
updatebarpos();
|
||||
XMapRaised(dpy, barwin);
|
||||
strcpy(stext, "dwm-"VERSION);
|
||||
|
Reference in New Issue
Block a user