From 186fe25ab798fe559be242dbe2eaff8e553c4e06 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Sat, 6 Jun 2020 19:28:06 -0700 Subject: checkin: before adding swallow --- sys/cmd/dwm/client.c | 66 +++++++--- sys/cmd/dwm/config.h | 44 ++++--- sys/cmd/dwm/drw.c | 10 +- sys/cmd/dwm/dwm.c | 350 ++------------------------------------------------ sys/cmd/dwm/dwm.h | 53 ++++---- sys/cmd/dwm/rules.mk | 1 + sys/cmd/dwm/util.c | 1 - sys/cmd/rules.mk | 4 +- sys/cmd/term/config.h | 4 +- sys/cmd/term/rules.mk | 2 +- 10 files changed, 131 insertions(+), 404 deletions(-) (limited to 'sys/cmd') diff --git a/sys/cmd/dwm/client.c b/sys/cmd/dwm/client.c index e9133bf..d2ea972 100644 --- a/sys/cmd/dwm/client.c +++ b/sys/cmd/dwm/client.c @@ -24,7 +24,8 @@ applyrules(Client *c) { c->isfloating = r->isfloating; c->tags |= r->tags; - for (m = mons; m && m->num != r->monitor; m = m->next); + for (m = mons; m && m->num != r->monitor; m = m->next) + ; if (m) c->mon = m; } @@ -109,6 +110,20 @@ attach(Client *c) c->mon->clients = c; } +void +enqueue(Client *c) +{ + Client *l; + + for (l = c->mon->clients; l && l->next; l = l->next) + ; + + if (l) { + l->next = c; + c->next = nil; + } +} + void attachstack(Client *c) { @@ -116,21 +131,34 @@ attachstack(Client *c) c->mon->stack = c; } +void +enqueuestack(Client *c) +{ + Client *l; + for (l = c->mon->clients; l && l->next; l = l->next) + ; + + if (l) { + l->snext = c; + c->snext = nil; + } +} + void configure(Client *c) { XConfigureEvent ce; - 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->bw; - ce.above = None; + 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->bw; + ce.above = None; ce.override_redirect = False; XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce); } @@ -140,7 +168,8 @@ detach(Client *c) { Client **tc; - for (tc = &c->mon->clients; *tc && *tc != c; tc = &(*tc)->next); + for (tc = &c->mon->clients; *tc && *tc != c; tc = &(*tc)->next) + ; *tc = c->next; } @@ -149,11 +178,14 @@ detachstack(Client *c) { Client **tc, *t; - for (tc = &c->mon->stack; *tc && *tc != c; tc = &(*tc)->snext); + for (tc = &c->mon->stack; *tc && *tc != c; tc = &(*tc)->snext) + ; + *tc = c->snext; if (c == c->mon->sel) { - for (t = c->mon->stack; t && !ISVISIBLE(t); t = t->snext); + for (t = c->mon->stack; t && !ISVISIBLE(t); t = t->snext) + ; c->mon->sel = t; } } @@ -162,7 +194,8 @@ void focus(Client *c) { if (!c || !ISVISIBLE(c)) - for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); + for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext) + ; if (selmon->sel && selmon->sel != c) unfocus(selmon->sel, 0); if (c) { @@ -223,7 +256,8 @@ grabbuttons(Client *c, int focused) Client * nexttiled(Client *c) { - for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next); + for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next) + ; return c; } diff --git a/sys/cmd/dwm/config.h b/sys/cmd/dwm/config.h index e7f2151..3e950ba 100644 --- a/sys/cmd/dwm/config.h +++ b/sys/cmd/dwm/config.h @@ -2,12 +2,14 @@ #define VERSION "1" /* appearance */ -static unsigned int borderpx = 1; /* border pixel of windows */ -static unsigned int snap = 32; /* snap pixel */ -static int showbar = 1; /* 0 means no bar */ -static int topbar = 1; /* 0 means bottom bar */ -static char *fonts[] = { "monospace:size=10" }; -static char dmenufont[] = "monospace:size=10"; +static uint borderpx = 1; /* border pixel of windows */ +static uint gapx = 4; /* gaps between windows */ +static uint snap = 32; /* snap pixel */ +static int swallowfloating = 1; /* will swallow floating by default */ +static int showbar = 1; /* 0 means no bar */ +static int topbar = 1; /* 0 means bottom bar */ +static char *fonts[] = { "consolas:size=14" }; +static char dmenufont[] = "consolas:size=14"; static char col_gray1[] = "#222222"; static char col_gray2[] = "#444444"; static char col_gray3[] = "#bbbbbb"; @@ -28,9 +30,10 @@ static Rule rules[] = { * WM_CLASS(STRING) = instance, class * WM_NAME(STRING) = title */ - /* class instance title tags mask isfloating monitor */ - { "Gimp", nil, nil, 0, 1, -1 }, - { "Firefox", nil, nil, 1 << 8, 0, -1 }, + /* class instance title tags mask isfloating isterminal noswallow monitor */ + { "Gimp", nil, nil, 0, 1, 0, 0, -1 }, + { "Firefox", nil, nil, 1 << 8, 0, 0, 01, -1 }, + { "term", nil, nil, 0, 0, 0, 1, -1 }, }; /* layout(s) */ @@ -41,12 +44,12 @@ static int resizehints = 1; /* 1 means respect size hints in tiled resizals * static Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, /* first entry is default */ - { "><>", nil }, /* no layout function means floating behavior */ + { "><>", nil }, /* no layout function means floating behavior */ { "[M]", monocle }, }; /* key definitions */ -#define MODKEY Mod1Mask +#define MODKEY Mod4Mask #define TAGKEYS(KEY,TAG) \ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ @@ -63,21 +66,24 @@ static char *termcmd[] = { "term", nil }; static Key keys[] = { /* modifier key function argument */ - { MODKEY, XK_p, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + { MODKEY, XK_d, spawn, {.v = dmenucmd } }, + { MODKEY, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_f, togglefocus, {0} }, { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, + { MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } }, + { MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } }, { MODKEY, XK_i, incnmaster, {.i = +1 } }, - { MODKEY, XK_d, incnmaster, {.i = -1 } }, + { MODKEY, XK_o, incnmaster, {.i = -1 } }, { MODKEY, XK_h, setmfact, {.f = -0.05} }, { MODKEY, XK_l, setmfact, {.f = +0.05} }, { MODKEY, XK_Return, zoom, {0} }, { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY|ShiftMask, XK_q, killclient, {0} }, + { MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY|ShiftMask, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY|ShiftMask, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, @@ -95,7 +101,7 @@ static Key keys[] = { TAGKEYS( XK_7, 6) TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask, XK_q, quit, {0} }, + { MODKEY|ShiftMask, XK_e, quit, {0} }, }; /* button definitions */ diff --git a/sys/cmd/dwm/drw.c b/sys/cmd/dwm/drw.c index 8369ae6..b4c993a 100644 --- a/sys/cmd/dwm/drw.c +++ b/sys/cmd/dwm/drw.c @@ -6,11 +6,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h { Drw *drw = ecalloc(1, sizeof(Drw)); - drw->dpy = dpy; - drw->screen = screen; - drw->root = root; - drw->w = w; - drw->h = h; + drw->dpy = dpy; + drw->screen = screen; + drw->root = root; + drw->w = w; + drw->h = h; drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen)); drw->gc = XCreateGC(dpy, root, 0, NULL); XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter); diff --git a/sys/cmd/dwm/dwm.c b/sys/cmd/dwm/dwm.c index d8b57e3..22ccc91 100644 --- a/sys/cmd/dwm/dwm.c +++ b/sys/cmd/dwm/dwm.c @@ -29,9 +29,9 @@ void (*handler[LASTEvent]) (XEvent *) = { Atom wmatom[WMLast] = {0}, netatom[NetLast] = {0}; int running = 1; Cur *cursor[MouseLast] = {0}; -Clr **scheme = nil; -Display *dpy = nil; -Drw *drw = nil; +Clr **scheme = nil; +Display *dpy = nil; +Drw *drw = nil; Monitor *mons = nil, *selmon = nil; Window root = {0}, wmcheckwin = {0}; @@ -267,6 +267,7 @@ createmon(void) m->nmaster = nmaster; m->showbar = showbar; m->topbar = topbar; + m->gapx = gapx; m->lt[0] = &layouts[0]; m->lt[1] = &layouts[1 % arrlen(layouts)]; strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); @@ -396,46 +397,6 @@ focusin(XEvent *e) setfocus(selmon->sel); } -void -focusmon(Arg *arg) -{ - Monitor *m; - - if (!mons->next) - return; - if ((m = dirtomon(arg->i)) == selmon) - return; - unfocus(selmon->sel, 0); - selmon = m; - focus(nil); -} - -void -focusstack(Arg *arg) -{ - Client *c = nil, *i; - - if (!selmon->sel) - return; - if (arg->i > 0) { - for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next); - if (!c) - for (c = selmon->clients; c && !ISVISIBLE(c); c = c->next); - } else { - for (i = selmon->clients; i != selmon->sel; i = i->next) - if (ISVISIBLE(i)) - c = i; - if (!c) - for (; i; i = i->next) - if (ISVISIBLE(i)) - c = i; - } - if (c) { - focus(c); - restack(selmon); - } -} - int getrootptr(int *x, int *y) { @@ -488,6 +449,7 @@ gettextprop(Window w, Atom atom, char *text, uint size) XFree(name.value); return 1; } + void grabkeys(void) { @@ -506,14 +468,8 @@ grabkeys(void) } } -void -incnmaster(Arg *arg) -{ - selmon->nmaster = MAX(selmon->nmaster + arg->i, 0); - arrange(selmon); -} - -static int +static +int isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info) { while (n--) @@ -539,22 +495,6 @@ keypress(XEvent *e) keys[i].func(&(keys[i].arg)); } -void -killclient(Arg *arg) -{ - if (!selmon->sel) - return; - if (!sendevent(selmon->sel, wmatom[WMDelete])) { - XGrabServer(dpy); - XSetErrorHandler(xerrordummy); - XSetCloseDownMode(dpy, DestroyAll); - XKillClient(dpy, selmon->sel->win); - XSync(dpy, False); - XSetErrorHandler(xerror); - XUngrabServer(dpy); - } -} - void manage(Window w, XWindowAttributes *wa) { @@ -673,66 +613,6 @@ motionnotify(XEvent *e) mon = m; } -void -movemouse(Arg *arg) -{ - int x, y, ocx, ocy, nx, ny; - Client *c; - Monitor *m; - XEvent ev; - Time lasttime = 0; - - if (!(c = selmon->sel)) - return; - if (c->isfullscreen) /* no support moving fullscreen windows by mouse */ - return; - restack(selmon); - ocx = c->x; - ocy = c->y; - if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, - None, cursor[MouseMove]->cursor, CurrentTime) != GrabSuccess) - return; - if (!getrootptr(&x, &y)) - return; - do { - XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); - switch(ev.type) { - case ConfigureRequest: - case Expose: - case MapRequest: - handler[ev.type](&ev); - break; - case MotionNotify: - if ((ev.xmotion.time - lasttime) <= (1000 / 60)) - continue; - lasttime = ev.xmotion.time; - - nx = ocx + (ev.xmotion.x - x); - ny = ocy + (ev.xmotion.y - y); - if (abs(selmon->wx - nx) < snap) - nx = selmon->wx; - else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap) - nx = selmon->wx + selmon->ww - WIDTH(c); - if (abs(selmon->wy - ny) < snap) - ny = selmon->wy; - else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap) - ny = selmon->wy + selmon->wh - HEIGHT(c); - if (!c->isfloating && selmon->lt[selmon->sellt]->arrange - && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) - togglefloating(nil); - if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) - resize(c, nx, ny, c->w, c->h, 1); - break; - } - } while (ev.type != ButtonRelease); - XUngrabPointer(dpy, CurrentTime); - if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { - sendtomon(c, m); - selmon = m; - focus(nil); - } -} - void propertynotify(XEvent *e) { @@ -770,12 +650,6 @@ propertynotify(XEvent *e) } } -void -quit(Arg *arg) -{ - running = 0; -} - Monitor * recttomon(int x, int y, int w, int h) { @@ -790,63 +664,6 @@ recttomon(int x, int y, int w, int h) return r; } -void -resizemouse(Arg *arg) -{ - int ocx, ocy, nw, nh; - Client *c; - Monitor *m; - XEvent ev; - Time lasttime = 0; - - if (!(c = selmon->sel)) - return; - if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */ - return; - restack(selmon); - ocx = c->x; - ocy = c->y; - if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, - None, cursor[MouseResize]->cursor, CurrentTime) != GrabSuccess) - return; - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); - do { - XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); - switch(ev.type) { - case ConfigureRequest: - case Expose: - case MapRequest: - handler[ev.type](&ev); - break; - case MotionNotify: - if ((ev.xmotion.time - lasttime) <= (1000 / 60)) - continue; - lasttime = ev.xmotion.time; - - nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); - nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); - if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww - && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh) - { - if (!c->isfloating && selmon->lt[selmon->sellt]->arrange - && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) - togglefloating(nil); - } - if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) - resize(c, c->x, c->y, nw, nh, 1); - break; - } - } while (ev.type != ButtonRelease); - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); - XUngrabPointer(dpy, CurrentTime); - while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); - if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { - sendtomon(c, m); - selmon = m; - focus(nil); - } -} - void restack(Monitor *m) { @@ -910,35 +727,6 @@ scan(void) } } -void -setlayout(Arg *arg) -{ - if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) - selmon->sellt ^= 1; - if (arg && arg->v) - selmon->lt[selmon->sellt] = (Layout *)arg->v; - strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); - if (selmon->sel) - arrange(selmon); - else - drawbar(selmon); -} - -/* arg > 1.0 will set mfact absolutely */ -void -setmfact(Arg *arg) -{ - float f; - - if (!arg || !selmon->lt[selmon->sellt]->arrange) - return; - f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; - if (f < 0.05 || f > 0.95) - return; - selmon->mfact = f; - arrange(selmon); -} - void setup(void) { @@ -1018,40 +806,6 @@ sigchld(int unused) while (0 < waitpid(-1, nil, WNOHANG)); } -void -spawn(Arg *arg) -{ - if (arg->v == dmenucmd) - dmenumon[0] = '0' + selmon->num; - if (fork() == 0) { - if (dpy) - close(ConnectionNumber(dpy)); - setsid(); - execvp(((char **)arg->v)[0], (char **)arg->v); - fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]); - perror(" failed"); - exit(EXIT_SUCCESS); - } -} - -void -tag(Arg *arg) -{ - if (selmon->sel && arg->ui & TAGMASK) { - selmon->sel->tags = arg->ui & TAGMASK; - focus(nil); - arrange(selmon); - } -} - -void -tagmon(Arg *arg) -{ - if (!selmon->sel || !mons->next) - return; - sendtomon(selmon->sel, dirtomon(arg->i)); -} - void tile(Monitor *m) { @@ -1068,68 +822,18 @@ tile(Monitor *m) mw = m->ww; for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) if (i < m->nmaster) { - h = (m->wh - my) / (MIN(n, m->nmaster) - i); - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); - if (my + HEIGHT(c) < m->wh) - my += HEIGHT(c); + h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gapx; + resize(c, m->wx, m->wy + my, mw - (2*c->bw) - m->gapx, h - (2*c->bw), 0); + if (my + HEIGHT(c) + m->gapx < m->wh) + my += HEIGHT(c) + m->gapx; } else { - h = (m->wh - ty) / (n - i); - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); + h = (m->wh - ty) / (n - i) - m->gapx; + resize(c, m->wx + mw + m->gapx, m->wy + ty, m->ww - mw - (2*c->bw) - (2*m->gapx), h - (2*c->bw), 0); if (ty + HEIGHT(c) < m->wh) - ty += HEIGHT(c); + ty += HEIGHT(c) + m->gapx; } } -void -togglebar(Arg *arg) -{ - selmon->showbar = !selmon->showbar; - updatebarpos(selmon); - XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); - arrange(selmon); -} - -void -togglefloating(Arg *arg) -{ - if (!selmon->sel) - return; - if (selmon->sel->isfullscreen) /* no support for fullscreen windows */ - return; - selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; - if (selmon->sel->isfloating) - resize(selmon->sel, selmon->sel->x, selmon->sel->y, - selmon->sel->w, selmon->sel->h, 0); - arrange(selmon); -} - -void -toggletag(Arg *arg) -{ - uint newtags; - - if (!selmon->sel) - return; - newtags = selmon->sel->tags ^ (arg->ui & TAGMASK); - if (newtags) { - selmon->sel->tags = newtags; - focus(nil); - arrange(selmon); - } -} - -void -toggleview(Arg *arg) -{ - uint newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK); - - if (newtagset) { - selmon->tagset[selmon->seltags] = newtagset; - focus(nil); - arrange(selmon); - } -} - void unmapnotify(XEvent *e) { @@ -1293,18 +997,6 @@ updatestatus(void) drawbar(selmon); } -void -view(Arg *arg) -{ - if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) - return; - selmon->seltags ^= 1; /* toggle sel tagset */ - if (arg->ui & TAGMASK) - selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; - focus(nil); - arrange(selmon); -} - Client * wintoclient(Window w) { @@ -1371,20 +1063,6 @@ xerrorstart(Display *dpy, XErrorEvent *ee) return -1; } -void -zoom(Arg *arg) -{ - Client *c = selmon->sel; - - if (!selmon->lt[selmon->sellt]->arrange - || (selmon->sel && selmon->sel->isfloating)) - return; - if (c == nexttiled(selmon->clients)) - if (!c || !(c = nexttiled(c->next))) - return; - pop(c); -} - int main(int argc, char *argv[]) { diff --git a/sys/cmd/dwm/dwm.h b/sys/cmd/dwm/dwm.h index 71d7e6c..d8bfbb3 100644 --- a/sys/cmd/dwm/dwm.h +++ b/sys/cmd/dwm/dwm.h @@ -129,7 +129,7 @@ struct Client { Client *next; Client *snext; Monitor *mon; - Window win; + Window win; }; struct Key { @@ -152,6 +152,7 @@ struct Monitor { int by; /* bar geometry */ int mx, my, mw, mh; /* screen size */ int wx, wy, ww, wh; /* window area */ + int gapx; /* gaps */ uint seltags; uint sellt; uint tagset[2]; @@ -175,30 +176,32 @@ struct Rule { }; /* draw.c */ - typedef struct { - Cursor cursor; + union { + Cursor; + Cursor cursor; + }; } Cur; typedef struct Fnt { - Display *dpy; - unsigned int h; - XftFont *xfont; + Display *dpy; + uint h; + XftFont *xfont; FcPattern *pattern; struct Fnt *next; } Fnt; -typedef XftColor Clr; +typedef XftColor Color; typedef struct { - unsigned int w, h; + uint w, h; Display *dpy; int screen; Window root; Drawable drawable; GC gc; - Clr *scheme; - Fnt *fonts; + Color *scheme; + Font *fonts; } Drw; /* global state */ @@ -211,11 +214,12 @@ extern int bh, blw; extern int lrpad; extern int (*xerrorxlib)(Display *, XErrorEvent *); extern uint numlockmask; +extern void (*handler[LASTEvent]) (XEvent *); extern Atom wmatom[WMLast], netatom[NetLast]; extern int running; extern Cur *cursor[MouseLast]; -extern Clr **scheme; +extern Color **scheme; extern Display *dpy; extern Drw *drw; extern Monitor *mons, *selmon; @@ -224,12 +228,15 @@ extern Window root, wmcheckwin; // ----------------------------------------------------------------------- // function declarations +// TODO: remove declarations that don't require global existence... void applyrules(Client *c); int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); void arrange(Monitor *m); void arrangemon(Monitor *m); void attach(Client *c); +void enqueue(Client *c); void attachstack(Client *c); +void enqueuestack(Client *c); void buttonpress(XEvent *e); void checkotherwm(void); void cleanup(void); @@ -251,6 +258,7 @@ void focus(Client *c); void focusin(XEvent *e); void focusmon(Arg *arg); void focusstack(Arg *arg); +void rotatestack(Arg *arg); Atom getatomprop(Client *c, Atom prop); int getrootptr(int *x, int *y); long getstate(Window w); @@ -293,6 +301,7 @@ void tag(Arg *arg); void tagmon(Arg *arg); void tile(Monitor *); void togglebar(Arg *arg); +void togglefocus(Arg *arg); void togglefloating(Arg *arg); void toggletag(Arg *arg); void toggleview(Arg *arg); @@ -322,19 +331,19 @@ void zoom(Arg *arg); /* draw.c */ /* Drawable abstraction */ -Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); -void drw_resize(Drw *drw, unsigned int w, unsigned int h); +Drw *drw_create(Display *dpy, int screen, Window win, uint w, uint h); +void drw_resize(Drw *drw, uint w, uint h); void drw_free(Drw *drw); /* Fnt abstraction */ Fnt *drw_fontset_create(Drw* drw, char *fonts[], size_t fontcount); void drw_fontset_free(Fnt* set); -unsigned int drw_fontset_getwidth(Drw *drw, char *text); -void drw_font_getexts(Fnt *font, char *text, unsigned int len, unsigned int *w, unsigned int *h); +uint drw_fontset_getwidth(Drw *drw, char *text); +void drw_font_getexts(Fnt *font, char *text, uint len, uint *w, uint *h); /* Colorscheme abstraction */ -void drw_clr_create(Drw *drw, Clr *dest, char *clrname); -Clr *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount); +void drw_clr_create(Drw *drw, Color *dest, char *clrname); +Color *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount); /* Cursor abstraction */ Cur *drw_cur_create(Drw *drw, int shape); @@ -342,15 +351,15 @@ void drw_cur_free(Drw *drw, Cur *cursor); /* Drawing context manipulation */ void drw_setfontset(Drw *drw, Fnt *set); -void drw_setscheme(Drw *drw, Clr *scm); +void drw_setscheme(Drw *drw, Color *scm); /* Drawing functions */ -void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert); -int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, char *text, int invert); +void drw_rect(Drw *drw, int x, int y, uint w, uint h, int filled, int invert); +int drw_text(Drw *drw, int x, int y, uint w, uint h, uint lpad, char *text, int invert); /* Map functions */ -void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); +void drw_map(Drw *drw, Window win, int x, int y, uint w, uint h); /* util.c */ -void fatal(char *fmt, ...); +void fatal(char *fmt, ...); void *ecalloc(size_t nmemb, size_t size); diff --git a/sys/cmd/dwm/rules.mk b/sys/cmd/dwm/rules.mk index 5512ea6..bc4d574 100644 --- a/sys/cmd/dwm/rules.mk +++ b/sys/cmd/dwm/rules.mk @@ -4,6 +4,7 @@ include share/push.mk # Local sources SRCS_$(d) := \ $(d)/drw.c \ + $(d)/hook.c \ $(d)/client.c \ $(d)/util.c \ $(d)/dwm.c diff --git a/sys/cmd/dwm/util.c b/sys/cmd/dwm/util.c index c9cc726..1306c9c 100644 --- a/sys/cmd/dwm/util.c +++ b/sys/cmd/dwm/util.c @@ -31,4 +31,3 @@ ecalloc(size_t nmemb, size_t size) fatal("calloc:"); return p; } - diff --git a/sys/cmd/rules.mk b/sys/cmd/rules.mk index d23396c..1a6bd88 100644 --- a/sys/cmd/rules.mk +++ b/sys/cmd/rules.mk @@ -14,8 +14,8 @@ include $(DIR)/rules.mk # DIR := $(d)/rc # include $(DIR)/rules.mk -# DIR := $(d)/dwm -# include $(DIR)/rules.mk +DIR := $(d)/dwm +include $(DIR)/rules.mk DIR := $(d)/term include $(DIR)/rules.mk diff --git a/sys/cmd/term/config.h b/sys/cmd/term/config.h index 81b11b0..fcbe775 100644 --- a/sys/cmd/term/config.h +++ b/sys/cmd/term/config.h @@ -6,7 +6,7 @@ * * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html */ -static char *font = "Hack:pixelsize=14:antialias=true:autohint=true"; +static char *font = "consolas:pixelsize=14:antialias=true"; static int borderpx = 2; /* @@ -95,7 +95,7 @@ char *termname = "term-256color"; uint tabspaces = 4; /* bg opacity */ -float alpha = 0.85; +float alpha = 0.95; /* Terminal colors (16 first used in escape sequence) */ static char *colorname[] = { diff --git a/sys/cmd/term/rules.mk b/sys/cmd/term/rules.mk index 1b0fae3..55e85c3 100644 --- a/sys/cmd/term/rules.mk +++ b/sys/cmd/term/rules.mk @@ -2,7 +2,7 @@ include share/push.mk # Iterate through subdirectory tree # Local sources -SRCS_$(d) := $(d)/term.c $(d)/x.c $(d)/util.c +SRCS_$(d) := $(d)/term.c $(d)/x.c #$(d)/util.c BINS_$(d) := $(d)/term include share/paths.mk -- cgit v1.2.1