diff --git a/dwm/config.def.h b/dwm/config.def.h index 3020e60..b6bbdcc 100644 --- a/dwm/config.def.h +++ b/dwm/config.def.h @@ -1,4 +1,5 @@ /* See LICENSE file for copyright and license details. */ +#include "dwm.h" /* appearance */ static const unsigned int borderpx = 1; /* border pixel of windows */ @@ -15,15 +16,11 @@ static const char col_gray3[] = "#bbbbbb"; static const char col_gray4[] = "#eeeeee"; static const char col_cyan[] = "#005577"; static const char col_red[] = "#ff0000"; + static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeSel] = { col_gray4, col_red, col_red }, - //[SchemeStatus] = { col_gray3, col_gray1, "#000000" }, // Statusbar right {text,background,not used but cannot be empty} - //[SchemeTagsSel] = { col_gray4, col_cyan, "#000000" }, // Tagbar left selected {text,background,not used but cannot be empty} - //[SchemeTagsNorm] = { col_gray3, col_gray1, "#000000" }, // Tagbar left unselected {text,background,not used but cannot be empty} - //[SchemeInfoSel] = { col_gray4, col_cyan, "#000000" }, // infobar middle selected {text,background,not used but cannot be empty} - //[SchemeInfoNorm] = { col_gray3, col_gray1, "#000000" }, // infobar middle unselected {text,background,not used but cannot be empty} }; /* tagging */ @@ -65,6 +62,7 @@ static const Layout layouts[] = { /* commands */ static const char *dmenucmd[] = { "dmenu_run", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, "-F", NULL }; static const char *termcmd[] = { "dwm_terminal_emulator", NULL }; +static const char *emacscmd[] = { "emacs", NULL }; static Key keys[] = { /* modifier key function argument */ @@ -105,6 +103,7 @@ static Key keys[] = { TAGKEYS( XK_3, 2) TAGKEYS( XK_4, 3) { MODKEY|ShiftMask, XK_q, quit, {0} }, + { 0, XK_F7, spawn, {.v = emacscmd} }, }; /* button definitions */ @@ -123,3 +122,4 @@ static const Button buttons[] = { { ClkTagBar, MODKEY, Button1, tag, {0} }, { ClkTagBar, MODKEY, Button3, toggletag, {0} }, }; + diff --git a/dwm/config.h b/dwm/config.h index 41e59e7..b6bbdcc 100644 --- a/dwm/config.h +++ b/dwm/config.h @@ -1,4 +1,5 @@ /* See LICENSE file for copyright and license details. */ +#include "dwm.h" /* appearance */ static const unsigned int borderpx = 1; /* border pixel of windows */ @@ -15,15 +16,11 @@ static const char col_gray3[] = "#bbbbbb"; static const char col_gray4[] = "#eeeeee"; static const char col_cyan[] = "#005577"; static const char col_red[] = "#ff0000"; + static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeSel] = { col_gray4, col_red, col_red }, - //[SchemeStatus] = { col_gray3, col_gray1, "#000000" }, // Statusbar right {text,background,not used but cannot be empty} - //[SchemeTagsSel] = { col_gray4, col_cyan, "#000000" }, // Tagbar left selected {text,background,not used but cannot be empty} - //[SchemeTagsNorm] = { col_gray3, col_gray1, "#000000" }, // Tagbar left unselected {text,background,not used but cannot be empty} - //[SchemeInfoSel] = { col_gray4, col_cyan, "#000000" }, // infobar middle selected {text,background,not used but cannot be empty} - //[SchemeInfoNorm] = { col_gray3, col_gray1, "#000000" }, // infobar middle unselected {text,background,not used but cannot be empty} }; /* tagging */ @@ -35,7 +32,7 @@ static const Rule rules[] = { /* WM_NAME(STRING) = title */ /* class instance title tags mask isfloating monitor */ { "Gimp", NULL, NULL, 0, 0, -1 }, - //{ "Firefox", NULL, NULL, 1 << 8, 0, -1 }, + { "hot-babe", NULL, NULL, 0, 1, -1 }, }; /* layout(s) */ @@ -65,6 +62,7 @@ static const Layout layouts[] = { /* commands */ static const char *dmenucmd[] = { "dmenu_run", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, "-F", NULL }; static const char *termcmd[] = { "dwm_terminal_emulator", NULL }; +static const char *emacscmd[] = { "emacs", NULL }; static Key keys[] = { /* modifier key function argument */ @@ -105,6 +103,7 @@ static Key keys[] = { TAGKEYS( XK_3, 2) TAGKEYS( XK_4, 3) { MODKEY|ShiftMask, XK_q, quit, {0} }, + { 0, XK_F7, spawn, {.v = emacscmd} }, }; /* button definitions */ @@ -123,3 +122,4 @@ static const Button buttons[] = { { ClkTagBar, MODKEY, Button1, tag, {0} }, { ClkTagBar, MODKEY, Button3, toggletag, {0} }, }; + diff --git a/dwm/drw.h b/dwm/drw.h index 6471431..18739bb 100644 --- a/dwm/drw.h +++ b/dwm/drw.h @@ -1,4 +1,10 @@ +#ifndef DRW_H +#define DRW_H + /* See LICENSE file for copyright and license details. */ +#include +#include + typedef struct { Cursor cursor; @@ -56,3 +62,5 @@ int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned in /* Map functions */ void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); + +#endif diff --git a/dwm/dwm.c b/dwm/dwm.c index 65f182f..df75280 100644 --- a/dwm/dwm.c +++ b/dwm/dwm.c @@ -20,6 +20,7 @@ * * To understand everything else, start reading main(). */ + #include #include #include @@ -43,234 +44,9 @@ #include "drw.h" #include "util.h" +#include "dwm.h" -/* macros */ -#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) -#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) -#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ - * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) -#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) -#define LENGTH(X) (sizeof X / sizeof X[0]) -#define MOUSEMASK (BUTTONMASK|PointerMotionMask) -#define WIDTH(X) ((X)->w + 2 * (X)->bw) -#define HEIGHT(X) ((X)->h + 2 * (X)->bw) -#define TAGMASK ((1 << LENGTH(tags)) - 1) -#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) -/* enums */ -enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -enum { SchemeNorm, SchemeSel }; /* color schemes */ -enum { NetSupported, NetWMName, NetWMState, NetWMCheck, - NetWMFullscreen, NetActiveWindow, NetWMWindowType, - NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ -enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ -enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, - ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ - -typedef union { - int i; - unsigned int ui; - float f; - const void *v; -} Arg; - -typedef struct { - unsigned int click; - unsigned int mask; - unsigned int button; - void (*func)(const Arg *arg); - const Arg arg; -} Button; - -typedef struct Monitor Monitor; -typedef struct Client Client; -struct Client { - char name[256]; - float mina, maxa; - int x, y, w, h; - int oldx, oldy, oldw, oldh; - int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; - int bw, oldbw; - unsigned int tags; - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; - Client *next; - Client *snext; - Monitor *mon; - Window win; -}; - -typedef struct { - unsigned int mod; - KeySym keysym; - void (*func)(const Arg *); - const Arg arg; -} Key; - -typedef struct { - const char *symbol; - void (*arrange)(Monitor *); -} Layout; - -struct Monitor { - char ltsymbol[16]; - float mfact; - int nmaster; - int num; - int by; /* bar geometry */ - int mx, my, mw, mh; /* screen size */ - int wx, wy, ww, wh; /* window area */ - unsigned int seltags; - unsigned int sellt; - unsigned int tagset[2]; - int showbar; - int topbar; - Client *clients; - Client *sel; - Client *stack; - Monitor *next; - Window barwin; - const Layout *lt[2]; -}; - -typedef struct { - const char *class; - const char *instance; - const char *title; - unsigned int tags; - int isfloating; - int monitor; -} Rule; - -/* function declarations */ -static void applyrules(Client *c); -static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); -static void arrange(Monitor *m); -static void arrangemon(Monitor *m); -static void attach(Client *c); -static void attachstack(Client *c); -static void buttonpress(XEvent *e); -static void checkotherwm(void); -static void cleanup(void); -static void cleanupmon(Monitor *mon); -static void clientmessage(XEvent *e); -static void configure(Client *c); -static void configurenotify(XEvent *e); -static void configurerequest(XEvent *e); -static Monitor *createmon(void); -static void destroynotify(XEvent *e); -static void detach(Client *c); -static void detachstack(Client *c); -static Monitor *dirtomon(int dir); -static void drawbar(Monitor *m); -static void drawbars(void); -static void enternotify(XEvent *e); -static void expose(XEvent *e); -static void focus(Client *c); -static void focusin(XEvent *e); -static void focusmon(const Arg *arg); -static void focusstack(const Arg *arg); -static Atom getatomprop(Client *c, Atom prop); -static int getrootptr(int *x, int *y); -static long getstate(Window w); -static int gettextprop(Window w, Atom atom, char *text, unsigned int size); -static void grabbuttons(Client *c, int focused); -static void grabkeys(void); -static void incnmaster(const Arg *arg); -static void keypress(XEvent *e); -static void killclient(const Arg *arg); -static void manage(Window w, XWindowAttributes *wa); -static void mappingnotify(XEvent *e); -static void maprequest(XEvent *e); -static void monocle(Monitor *m); -static void motionnotify(XEvent *e); -static void movemouse(const Arg *arg); -static Client *nexttiled(Client *c); -static void pop(Client *c); -static void propertynotify(XEvent *e); -static void quit(const Arg *arg); -static Monitor *recttomon(int x, int y, int w, int h); -static void resize(Client *c, int x, int y, int w, int h, int interact); -static void resizeclient(Client *c, int x, int y, int w, int h); -static void resizemouse(const Arg *arg); -static void restack(Monitor *m); -static void run(void); -static void scan(void); -static int sendevent(Client *c, Atom proto); -static void sendmon(Client *c, Monitor *m); -static void setclientstate(Client *c, long state); -static void setfocus(Client *c); -static void setfullscreen(Client *c, int fullscreen); -static void setlayout(const Arg *arg); -static void setmfact(const Arg *arg); -static void setup(void); -static void seturgent(Client *c, int urg); -static void showhide(Client *c); -static void sigchld(int unused); -static void spawn(const Arg *arg); -static void tag(const Arg *arg); -static void tagmon(const Arg *arg); -static void tile(Monitor *m); -static void togglebar(const Arg *arg); -static void togglefloating(const Arg *arg); -static void togglefullscreen(const Arg *arg); -static void toggletag(const Arg *arg); -static void toggleview(const Arg *arg); -static void unfocus(Client *c, int setfocus); -static void unmanage(Client *c, int destroyed); -static void unmapnotify(XEvent *e); -static void updatebarpos(Monitor *m); -static void updatebars(void); -static void updateclientlist(void); -static int updategeom(void); -static void updatenumlockmask(void); -static void updatesizehints(Client *c); -static void updatestatus(void); -static void updatetitle(Client *c); -static void updatewindowtype(Client *c); -static void updatewmhints(Client *c); -static void view(const Arg *arg); -static Client *wintoclient(Window w); -static Monitor *wintomon(Window w); -static int xerror(Display *dpy, XErrorEvent *ee); -static int xerrordummy(Display *dpy, XErrorEvent *ee); -static int xerrorstart(Display *dpy, XErrorEvent *ee); -static void zoom(const Arg *arg); - -/* variables */ -static const char broken[] = "broken"; -static char stext[256]; -static int screen; -static int sw, sh; /* X display screen geometry width, height */ -static int bh; /* bar height */ -static int lrpad; /* sum of left and right padding for text */ -static int (*xerrorxlib)(Display *, XErrorEvent *); -static unsigned int numlockmask = 0; -static void (*handler[LASTEvent]) (XEvent *) = { - [ButtonPress] = buttonpress, - [ClientMessage] = clientmessage, - [ConfigureRequest] = configurerequest, - [ConfigureNotify] = configurenotify, - [DestroyNotify] = destroynotify, - [EnterNotify] = enternotify, - [Expose] = expose, - [FocusIn] = focusin, - [KeyPress] = keypress, - [MappingNotify] = mappingnotify, - [MapRequest] = maprequest, - [MotionNotify] = motionnotify, - [PropertyNotify] = propertynotify, - [UnmapNotify] = unmapnotify -}; -static Atom wmatom[WMLast], netatom[NetLast]; -static int running = 1; -static Cur *cursor[CurLast]; -static Clr **scheme; -static Display *dpy; -static Drw *drw; -static Monitor *mons - -, *selmon; -static Window root, wmcheckwin; /* configuration, allows nested code to access above variables */ #include "config.h" @@ -439,11 +215,11 @@ buttonpress(XEvent *e) i = x = 0; do x += TEXTW(tags[i]); - while (ev->x >= x && ++i < LENGTH(tags)); + while ((unsigned int)ev->x >= x && ++i < LENGTH(tags)); if (i < LENGTH(tags)) { click = ClkTagBar; arg.ui = 1 << i; - } else if (ev->x < x + TEXTW(selmon->ltsymbol)) + } else if ((unsigned int)ev->x < x + TEXTW(selmon->ltsymbol)) click = ClkLtSymbol; else if (ev->x > selmon->ww - (int)TEXTW(stext)) click = ClkStatusText; @@ -525,8 +301,8 @@ clientmessage(XEvent *e) if (!c) return; if (cme->message_type == netatom[NetWMState]) { - if (cme->data.l[1] == netatom[NetWMFullscreen] - || cme->data.l[2] == netatom[NetWMFullscreen]) + if ((unsigned long)cme->data.l[1] == netatom[NetWMFullscreen] + || (unsigned long) cme->data.l[2] == netatom[NetWMFullscreen]) setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); } else if (cme->message_type == netatom[NetActiveWindow]) { @@ -713,7 +489,7 @@ drawbar(Monitor *m) /* draw status first so it can be overdrawn by tags later */ //if (m == selmon || 1) { /* status is only drawn on selected monitor */ - if (m->num == 0) { + if (m->num == 1) { drw_setscheme(drw, scheme[SchemeNorm]); tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0); @@ -1173,16 +949,16 @@ movemouse(const Arg *arg) nx = ocx + (ev.xmotion.x - x); ny = ocy + (ev.xmotion.y - y); - if (abs(selmon->wx - nx) < snap) + if ((unsigned int)abs(selmon->wx - nx) < snap) nx = selmon->wx; - else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap) + else if ((unsigned int)abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap) nx = selmon->wx + selmon->ww - WIDTH(c); - if (abs(selmon->wy - ny) < snap) + if ((unsigned int)abs(selmon->wy - ny) < snap) ny = selmon->wy; - else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap) + else if ((unsigned int)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)) + && ((unsigned int)abs(nx - c->x) > snap || (unsigned int)abs(ny - c->y) > snap)) togglefloating(NULL); if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) resize(c, nx, ny, c->w, c->h, 1); @@ -1331,7 +1107,7 @@ resizemouse(const Arg *arg) && 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)) + && ((unsigned int)abs(nw - c->w) > snap || (unsigned int)abs(nh - c->h) > snap)) togglefloating(NULL); } if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) @@ -1534,7 +1310,7 @@ setmfact(const Arg *arg) void setup(void) { - int i; + unsigned long i; XSetWindowAttributes wa; Atom utf8string; @@ -1673,7 +1449,8 @@ tagmon(const Arg *arg) void tile(Monitor *m) { - unsigned int i, n, h, mw, my, ty; + unsigned int h, mw, my, ty; + int n, i; Client *c; for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); @@ -1688,12 +1465,12 @@ tile(Monitor *m) 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) + if (my + HEIGHT(c) < (unsigned int)m->wh) my += HEIGHT(c); } 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); - if (ty + HEIGHT(c) < m->wh) + if (ty + HEIGHT(c) < (unsigned int)m->wh) ty += HEIGHT(c); } } @@ -1942,7 +1719,8 @@ updategeom(void) void updatenumlockmask(void) { - unsigned int i, j; + unsigned int i; + int j; XModifierKeymap *modmap; numlockmask = 0; diff --git a/dwm/dwm.h b/dwm/dwm.h new file mode 100644 index 0000000..70d54e4 --- /dev/null +++ b/dwm/dwm.h @@ -0,0 +1,238 @@ +#ifndef DWM_H +#define DWM_H + +#include +#include +#include +#include "drw.h" + +// These were originally in dwm.c, but my linter hated this (for good reason) +// Including them here instead + +/* macros */ +#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) +#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) +#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ + * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) +#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) +#define LENGTH(X) (sizeof X / sizeof X[0]) +#define MOUSEMASK (BUTTONMASK|PointerMotionMask) +#define WIDTH(X) ((X)->w + 2 * (X)->bw) +#define HEIGHT(X) ((X)->h + 2 * (X)->bw) +#define TAGMASK ((1 << LENGTH(tags)) - 1) +#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) + +/* enums */ +enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ +enum { SchemeNorm, SchemeSel }; /* color schemes */ +enum { NetSupported, NetWMName, NetWMState, NetWMCheck, + NetWMFullscreen, NetActiveWindow, NetWMWindowType, + NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ +enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ +enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, + ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ + +typedef union { + int i; + unsigned int ui; + float f; + const void *v; +} Arg; + +typedef struct { + unsigned int click; + unsigned int mask; + unsigned int button; + void (*func)(const Arg *arg); + const Arg arg; +} Button; + +typedef struct Monitor Monitor; +typedef struct Client Client; +struct Client { + char name[256]; + float mina, maxa; + int x, y, w, h; + int oldx, oldy, oldw, oldh; + int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; + int bw, oldbw; + unsigned int tags; + int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + Client *next; + Client *snext; + Monitor *mon; + Window win; +}; + +typedef struct { + unsigned int mod; + KeySym keysym; + void (*func)(const Arg *); + const Arg arg; +} Key; + +typedef struct { + const char *symbol; + void (*arrange)(Monitor *); +} Layout; + +struct Monitor { + char ltsymbol[16]; + float mfact; + int nmaster; + int num; + int by; /* bar geometry */ + int mx, my, mw, mh; /* screen size */ + int wx, wy, ww, wh; /* window area */ + unsigned int seltags; + unsigned int sellt; + unsigned int tagset[2]; + int showbar; + int topbar; + Client *clients; + Client *sel; + Client *stack; + Monitor *next; + Window barwin; + const Layout *lt[2]; +}; + +typedef struct { + const char *class; + const char *instance; + const char *title; + unsigned int tags; + int isfloating; + int monitor; +} Rule; + +/* function declarations */ +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 attachstack(Client *c); +void buttonpress(XEvent *e); +void checkotherwm(void); +void cleanup(void); +void cleanupmon(Monitor *mon); +void clientmessage(XEvent *e); +void configure(Client *c); +void configurenotify(XEvent *e); +void configurerequest(XEvent *e); +Monitor *createmon(void); +void destroynotify(XEvent *e); +void detach(Client *c); +void detachstack(Client *c); +Monitor *dirtomon(int dir); +void drawbar(Monitor *m); +void drawbars(void); +void enternotify(XEvent *e); +void expose(XEvent *e); +void focus(Client *c); +void focusin(XEvent *e); +void focusmon(const Arg *arg); +void focusstack(const Arg *arg); +Atom getatomprop(Client *c, Atom prop); +int getrootptr(int *x, int *y); +long getstate(Window w); +int gettextprop(Window w, Atom atom, char *text, unsigned int size); +void grabbuttons(Client *c, int focused); +void grabkeys(void); +void incnmaster(const Arg *arg); +void keypress(XEvent *e); +void killclient(const Arg *arg); +void manage(Window w, XWindowAttributes *wa); +void mappingnotify(XEvent *e); +void maprequest(XEvent *e); +void monocle(Monitor *m); +void motionnotify(XEvent *e); +void movemouse(const Arg *arg); +Client *nexttiled(Client *c); +void pop(Client *c); +void propertynotify(XEvent *e); +void quit(const Arg *arg); +Monitor *recttomon(int x, int y, int w, int h); +void resize(Client *c, int x, int y, int w, int h, int interact); +void resizeclient(Client *c, int x, int y, int w, int h); +void resizemouse(const Arg *arg); +void restack(Monitor *m); +void run(void); +void scan(void); +int sendevent(Client *c, Atom proto); +void sendmon(Client *c, Monitor *m); +void setclientstate(Client *c, long state); +void setfocus(Client *c); +void setfullscreen(Client *c, int fullscreen); +void setlayout(const Arg *arg); +void setmfact(const Arg *arg); +void setup(void); +void seturgent(Client *c, int urg); +void showhide(Client *c); +void sigchld(int unused); +void spawn(const Arg *arg); +void tag(const Arg *arg); +void tagmon(const Arg *arg); +void tile(Monitor *m); +void togglebar(const Arg *arg); +void togglefloating(const Arg *arg); +void togglefullscreen(const Arg *arg); +void toggletag(const Arg *arg); +void toggleview(const Arg *arg); +void unfocus(Client *c, int setfocus); +void unmanage(Client *c, int destroyed); +void unmapnotify(XEvent *e); +void updatebarpos(Monitor *m); +void updatebars(void); +void updateclientlist(void); +int updategeom(void); +void updatenumlockmask(void); +void updatesizehints(Client *c); +void updatestatus(void); +void updatetitle(Client *c); +void updatewindowtype(Client *c); +void updatewmhints(Client *c); +void view(const Arg *arg); +Client *wintoclient(Window w); +Monitor *wintomon(Window w); +int xerror(Display *dpy, XErrorEvent *ee); +int xerrordummy(Display *dpy, XErrorEvent *ee); +int xerrorstart(Display *dpy, XErrorEvent *ee); +void zoom(const Arg *arg); + +/* variables */ +const char broken[] = "broken"; +char stext[256]; +int screen; +int sw, sh; /* X display screen geometry width, height */ +int bh; /* bar height */ +int lrpad; /* sum of left and right padding for text */ +int (*xerrorxlib)(Display *, XErrorEvent *); +unsigned int numlockmask = 0; +void (*handler[LASTEvent]) (XEvent *) = { + [ButtonPress] = buttonpress, + [ClientMessage] = clientmessage, + [ConfigureRequest] = configurerequest, + [ConfigureNotify] = configurenotify, + [DestroyNotify] = destroynotify, + [EnterNotify] = enternotify, + [Expose] = expose, + [FocusIn] = focusin, + [KeyPress] = keypress, + [MappingNotify] = mappingnotify, + [MapRequest] = maprequest, + [MotionNotify] = motionnotify, + [PropertyNotify] = propertynotify, + [UnmapNotify] = unmapnotify +}; +Atom wmatom[WMLast], netatom[NetLast]; +int running = 1; +Cur *cursor[CurLast]; +Clr **scheme; +Display *dpy; +Drw *drw; +Monitor *mons, *selmon; +Window root, wmcheckwin; + +#endif