ClkLast
};
-typedef union {
+union arg {
int i;
unsigned int ui;
float f;
const void *v;
-} Arg;
+};
-typedef struct {
+struct button {
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;
+ void (*func)(const union arg *arg);
+ const union arg arg;
+};
-struct 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;
+ float mina;
+ float maxa;
+ int x;
+ int y;
+ int w;
+ int h;
+ int oldx;
+ int oldy;
+ int oldw;
+ int oldh;
+ int basew;
+ int baseh;
+ int incw;
+ int inch;
+ int maxw;
+ int maxh;
+ int minw;
+ int minh;
int bw, oldbw;
unsigned int tags;
Bool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
- Client *next;
- Client *snext;
- Monitor *mon;
+ struct client *next;
+ struct client *snext;
+ struct monitor *mon;
Window win;
};
-typedef struct {
+struct draw_context {
int x;
int y;
int w;
int height;
PangoLayout *layout;
} font;
-} DC; /* draw context */
+};
-typedef struct {
+struct key {
unsigned int mod;
KeySym keysym;
- void (*func)(const Arg *);
- const Arg arg;
-} Key;
+ void (*func)(const union arg *);
+ const union arg arg;
+};
-typedef struct {
+struct layout {
const char *symbol;
- void (*arrange)(Monitor *);
-} Layout;
+ void (*arrange)(struct monitor *);
+};
-struct Monitor {
+struct monitor {
char ltsymbol[16];
float mfact;
int nmaster;
unsigned int tagset[2];
Bool showbar;
Bool topbar;
- Client *clients;
- Client *sel;
- Client *stack;
- Monitor *next;
+ struct client *clients;
+ struct client *sel;
+ struct client *stack;
+ struct monitor *next;
Window barwin;
- const Layout *lt[2];
+ const struct layout *lt[2];
};
-typedef struct {
+struct rule {
const char *class;
const char *instance;
const char *title;
unsigned int tags;
Bool isfloating;
int monitor;
-} Rule;
+};
-typedef struct Systray Systray;
-struct Systray {
+struct systray {
Window win;
- Client *icons;
+ struct client *icons;
};
/* function declarations */
-static void applyrules(Client *c);
-static Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact);
-static void arrange(Monitor *m);
-static void arrangemon(Monitor *m);
-static void attach(Client *c);
-static void attachstack(Client *c);
+static void applyrules(struct client *c);
+static Bool applysizehints(struct client *c, int *x, int *y, int *w, int *h, Bool interact);
+static void arrange(struct monitor *m);
+static void arrangemon(struct monitor *m);
+static void attach(struct client *c);
+static void attachstack(struct client *c);
static void buttonpress(XEvent *e);
static int checkotherwm(void);
static void cleanup(void);
-static void cleanupmon(Monitor *mon);
-static void clearurgent(Client *c);
+static void cleanupmon(struct monitor *mon);
+static void clearurgent(struct client *c);
static void clientmessage(XEvent *e);
-static void configure(Client *c);
+static void configure(struct client *c);
static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e);
-static Monitor *createmon(void);
+static struct monitor *createmon(void);
static void destroynotify(XEvent *e);
-static void detach(Client *c);
-static void detachstack(Client *c);
+static void detach(struct client *c);
+static void detachstack(struct client *c);
static void die(const char *errstr, ...);
-static Monitor *dirtomon(int dir);
-static void drawbar(Monitor *m);
+static struct monitor *dirtomon(int dir);
+static void drawbar(struct monitor *m);
static void drawbars(void);
static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]);
static void drawtext(const char *text, unsigned long col[ColLast], Bool invert);
static void enternotify(XEvent *e);
#endif /* ! M10K */
static void expose(XEvent *e);
-static void focus(Client *c);
+static void focus(struct client *c);
static void focusin(XEvent *e);
-static void focusmon(const Arg *arg);
-static void focusstack(const Arg *arg);
+static void focusmon(const union arg *arg);
+static void focusstack(const union arg *arg);
static unsigned long getcolor(const char *colstr, XftColor *color);
static Bool getrootptr(int *x, int *y);
static long getstate(Window w);
static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
-static void grabbuttons(Client *c, Bool focused);
+static void grabbuttons(struct client *c, Bool focused);
static void grabkeys(void);
-static void incnmaster(const Arg *arg);
+static void incnmaster(const union arg *arg);
static void initfont(const char *fontstr);
static void keypress(XEvent *e);
-static void killclient(const Arg *arg);
+static void killclient(const union 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 monocle(struct monitor *m);
#ifndef M10K
static void motionnotify(XEvent *e);
#endif /* ! M10K */
-static void movemouse(const Arg *arg);
-static Client *nexttiled(Client *c);
-static void pop(Client *);
+static void movemouse(const union arg *arg);
+static struct client *nexttiled(struct client *c);
+static void pop(struct client *);
static void propertynotify(XEvent *e);
-static void quit(const Arg *arg);
-static Monitor *recttomon(int x, int y, int w, int h);
-static void removesystrayicon(Client *i);
-static void resize(Client *c, int x, int y, int w, int h, Bool interact);
-static void resizebarwin(Monitor *m);
-static void resizeclient(Client *c, int x, int y, int w, int h);
-static void resizemouse(const Arg *arg);
+static void quit(const union arg *arg);
+static struct monitor *recttomon(int x, int y, int w, int h);
+static void removesystrayicon(struct client *i);
+static void resize(struct client *c, int x, int y, int w, int h, Bool interact);
+static void resizebarwin(struct monitor *m);
+static void resizeclient(struct client *c, int x, int y, int w, int h);
+static void resizemouse(const union arg *arg);
static void resizerequest(XEvent *e);
-static void restack(Monitor *m);
+static void restack(struct monitor *m);
static void run(void);
static void scan(void);
static Bool sendevent(Window w, Atom proto, int m, long d0, long d1, long d2, long d3, long d4);
-static void sendmon(Client *c, Monitor *m);
-static void setclientstate(Client *c, long state);
-static void setfocus(Client *c);
-static void setfullscreen(Client *c, Bool fullscreen);
-static void setlayout(const Arg *arg);
+static void sendmon(struct client *c, struct monitor *m);
+static void setclientstate(struct client *c, long state);
+static void setfocus(struct client *c);
+static void setfullscreen(struct client *c, Bool fullscreen);
+static void setlayout(const union arg *arg);
#ifndef M10K
-static void setmfact(const Arg *arg);
+static void setmfact(const union arg *arg);
#endif /* ! M10K */
static void setup(void);
-static void showhide(Client *c);
+static void showhide(struct 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 spawn(const union arg *arg);
+static void tag(const union arg *arg);
+static void tagmon(const union arg *arg);
static int textnw(const char *text, unsigned int len);
-static void tile(Monitor *);
+static void tile(struct monitor *monitor);
#ifndef M10K
-static void togglebar(const Arg *arg);
+static void togglebar(const union arg *arg);
#endif /* ! M10K */
-static void togglefloating(const Arg *arg);
-static void toggletag(const Arg *arg);
-static void toggleview(const Arg *arg);
-static void unfocus(Client *c, Bool setfocus);
-static void unmanage(Client *c, Bool destroyed);
+static void togglefloating(const union arg *arg);
+static void toggletag(const union arg *arg);
+static void toggleview(const union arg *arg);
+static void unfocus(struct client *c, Bool setfocus);
+static void unmanage(struct client *c, Bool destroyed);
static void unmapnotify(XEvent *e);
static Bool updategeom(void);
-static void updatebarpos(Monitor *m);
+static void updatebarpos(struct monitor *m);
static void updatebars(void);
static void updatenumlockmask(void);
-static void updatesizehints(Client *c);
+static void updatesizehints(struct client *c);
static void updatestatus(void);
static void updatesystray(void);
-static void updatesystrayicongeom(Client *i, int w, int h);
-static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
-static void updatewindowtype(Client *c);
-static void updatetitle(Client *c);
-static void updatewmhints(Client *c);
-static void view(const Arg *arg);
-static Client *wintoclient(Window w);
-static Monitor *wintomon(Window w);
-static Client *wintosystrayicon(Window w);
+static void updatesystrayicongeom(struct client *i, int w, int h);
+static void updatesystrayiconstate(struct client *i, XPropertyEvent *ev);
+static void updatewindowtype(struct client *c);
+static void updatetitle(struct client *c);
+static void updatewmhints(struct client *c);
+static void view(const union arg *arg);
+static struct client *wintoclient(Window w);
+static struct monitor *wintomon(Window w);
+static struct client *wintosystrayicon(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);
-static Atom getatomprop(Client *c, Atom prop);
+static void zoom(const union arg *arg);
+static Atom getatomprop(struct client *c, Atom prop);
static unsigned int getsystraywidth(void);
-static void bookshelf(Monitor*);
-static void bookstack(Monitor*);
+static void bookshelf(struct monitor *mon);
+static void bookstack(struct monitor *mon);
/* variables */
-static Systray *systray = NULL;
+static struct systray *systray = NULL;
static unsigned long systrayorientation = _NET_SYSTEM_TRAY_ORIENTATION_HORZ;
static const char broken[] = "broken";
static char stext[512];
static Bool running = True;
static Cursor cursor[CurLast];
static Display *dpy;
-static DC dc;
-static Monitor *mons = NULL, *selmon = NULL;
+static struct draw_context dc;
+static struct monitor *mons = NULL;
+static struct monitor *selmon = NULL;
static Window root;
/* configuration, allows nested code to access above variables */
#include "config.h"
/* compile-time check if all tags fit into an unsigned int bit array. */
-struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
+struct NumTags {
+ char limitexceeded[LENGTH(tags) > 31 ? -1 : 1];
+};
/* function implementations */
-void applyrules(Client *c)
+void applyrules(struct client *c)
{
const char *class, *instance;
unsigned int i;
- const Rule *r;
- Monitor *m;
+ const struct rule *r;
+ struct monitor *m;
XClassHint ch = { NULL, NULL };
/* rule matching */
return;
}
-Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact)
+Bool applysizehints(struct client *c, int *x, int *y, int *w, int *h, Bool interact)
{
Bool baseismin;
- Monitor *m = c->mon;
+ struct monitor *m = c->mon;
/* set minimum possible */
*w = MAX(1, *w);
return(*x != c->x || *y != c->y || *w != c->w || *h != c->h);
}
-void arrange(Monitor *m)
+void arrange(struct monitor *m)
{
if(m) {
showhide(m->stack);
return;
}
-void arrangemon(Monitor *m)
+void arrangemon(struct monitor *m)
{
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
return;
}
-void attach(Client *c)
+void attach(struct client *c)
{
c->next = c->mon->clients;
c->mon->clients = c;
return;
}
-void attachstack(Client *c)
+void attachstack(struct client *c)
{
c->snext = c->mon->stack;
c->mon->stack = c;
void buttonpress(XEvent *e)
{
unsigned int i, x, click;
- Arg arg = {0};
- Client *c;
- Monitor *m;
+ union arg arg = {0};
+ struct client *c;
+ struct monitor *m;
XButtonPressedEvent *ev = &e->xbutton;
click = ClkRootWin;
void cleanup(void)
{
- Arg a = {.ui = ~0};
- Layout foo = { "", NULL };
- Monitor *m;
+ union arg a = {.ui = ~0};
+ struct layout foo = { "", NULL };
+ struct monitor *m;
int i;
view(&a);
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
}
-void cleanupmon(Monitor *mon)
+void cleanupmon(struct monitor *mon)
{
- Monitor *m;
+ struct monitor *m;
if(mon == mons)
mons = mons->next;
free(mon);
}
-void clearurgent(Client *c)
+void clearurgent(struct client *c)
{
XWMHints *wmh;
XWindowAttributes wa;
XSetWindowAttributes swa;
XClientMessageEvent *cme = &e->xclient;
- Client *c = wintoclient(cme->window);
+ struct client *c = wintoclient(cme->window);
if(showsystray && cme->window == systray->win && cme->message_type == netatom[NetSystemTrayOP]) {
/* add systray icons */
if(cme->data.l[1] == SYSTEM_TRAY_REQUEST_DOCK) {
- if(!(c = (Client *)calloc(1, sizeof(Client))))
- die("fatal: could not malloc() %u bytes\n", sizeof(Client));
+ if(!(c = (struct client*)calloc(1, sizeof(*c))))
+ die("fatal: could not malloc() %u bytes\n", sizeof(*c));
c->win = cme->data.l[2];
c->mon = selmon;
c->next = systray->icons;
return;
}
-void configure(Client *c)
+void configure(struct client *c)
{
XConfigureEvent ce;
void configurenotify(XEvent *e)
{
- Monitor *m;
+ struct monitor *m;
XConfigureEvent *ev = &e->xconfigure;
Bool dirty;
void configurerequest(XEvent *e)
{
- Client *c;
- Monitor *m;
+ struct client *c;
+ struct monitor *m;
XConfigureRequestEvent *ev = &e->xconfigurerequest;
XWindowChanges wc;
return;
}
-Monitor *createmon(void)
+struct monitor *createmon(void)
{
- Monitor *m;
+ struct monitor *m;
- if(!(m = (Monitor *)calloc(1, sizeof(Monitor)))) {
- die("fatal: could not malloc() %u bytes\n", sizeof(Monitor));
+ if(!(m = (struct monitor *)calloc(1, sizeof(*m)))) {
+ die("fatal: could not malloc() %u bytes\n", sizeof(*m));
}
m->tagset[0] = m->tagset[1] = 1;
void destroynotify(XEvent *e)
{
- Client *c;
+ struct client *c;
XDestroyWindowEvent *ev = &e->xdestroywindow;
if((c = wintoclient(ev->window))) {
return;
}
-void detach(Client *c)
+void detach(struct client *c)
{
- Client **tc;
+ struct client **tc;
for(tc = &c->mon->clients; *tc && *tc != c; tc = &(*tc)->next);
*tc = c->next;
return;
}
-void detachstack(Client *c)
+void detachstack(struct client *c)
{
- Client **tc, *t;
+ struct client **tc, *t;
for(tc = &c->mon->stack; *tc && *tc != c; tc = &(*tc)->snext);
*tc = c->snext;
return;
}
-Monitor *dirtomon(int dir)
+struct monitor *dirtomon(int dir)
{
- Monitor *m = NULL;
+ struct monitor *m = NULL;
if(dir > 0) {
if(!(m = selmon->next))
return(m);
}
-void drawbar(Monitor *m)
+void drawbar(struct monitor *m)
{
int x;
unsigned int i, occ = 0, urg = 0;
unsigned long *col;
- Client *c;
+ struct client *c;
resizebarwin(m);
void drawbars(void)
{
- Monitor *m;
+ struct monitor *m;
for(m = mons; m; m = m->next) {
drawbar(m);
#ifndef M10K
void enternotify(XEvent *e)
{
- Client *c;
- Monitor *m;
+ struct client *c;
+ struct monitor *m;
XCrossingEvent *ev = &e->xcrossing;
if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root) {
void expose(XEvent *e)
{
- Monitor *m;
+ struct monitor *m;
XExposeEvent *ev = &e->xexpose;
if(ev->count == 0 && (m = wintomon(ev->window))) {
return;
}
-void focus(Client *c)
+void focus(struct client *c)
{
if(!c || !ISVISIBLE(c)) {
for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
return;
}
-void focusmon(const Arg *arg)
+void focusmon(const union arg *arg)
{
- Monitor *m;
+ struct monitor *m;
if(!mons->next) {
return;
return;
}
-void focusstack(const Arg *arg)
+void focusstack(const union arg *arg)
{
- Client *c = NULL, *i;
+ struct client *c = NULL, *i;
if(!selmon->sel) {
return;
return;
}
-Atom getatomprop(Client *c, Atom prop)
+Atom getatomprop(struct client *c, Atom prop)
{
int di;
unsigned long dl;
unsigned int getsystraywidth(void)
{
unsigned int w = 0;
- Client *i;
+ struct client *i;
if(showsystray) {
for(i = systray->icons; i; w += i->w + systrayspacing, i = i->next) ;
}
return(True);
}
-void grabbuttons(Client *c, Bool focused)
+void grabbuttons(struct client *c, Bool focused)
{
updatenumlockmask();
{
return;
}
-void incnmaster(const Arg *arg)
+void incnmaster(const union arg *arg)
{
selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
arrange(selmon);
return;
}
-void killclient(const Arg *arg)
+void killclient(const union arg *arg)
{
if(selmon->sel && !sendevent(selmon->sel->win, wmatom[WMDelete],
NoEventMask, wmatom[WMDelete],
void manage(Window w, XWindowAttributes *wa)
{
- Client *c, *t = NULL;
- Window trans = None;
+ struct client *c;
+ struct client *t;
+ Window trans;
XWindowChanges wc;
- if(!(c = calloc(1, sizeof(Client)))) {
- die("fatal: could not malloc() %u bytes\n", sizeof(Client));
+ t = NULL;
+ trans = None;
+
+ if(!(c = calloc(1, sizeof(*c)))) {
+ die("fatal: could not malloc() %u bytes\n", sizeof(*c));
}
c->win = w;
{
static XWindowAttributes wa;
XMapRequestEvent *ev = &e->xmaprequest;
- Client *i;
+ struct client *i;
if((i = wintosystrayicon(ev->window))) {
sendevent(i->win, netatom[Xembed], StructureNotifyMask,
return;
}
-void monocle(Monitor *m)
+void monocle(struct monitor *m)
{
unsigned int n = 0;
- Client *c;
+ struct client *c;
for(c = m->clients; c; c = c->next) {
if(ISVISIBLE(c)) {
#ifndef M10K
void motionnotify(XEvent *e)
{
- static Monitor *mon = NULL;
- Monitor *m;
+ static struct monitor *mon = NULL;
+ struct monitor *m;
XMotionEvent *ev = &e->xmotion;
if(ev->window != root) {
}
#endif /* ! M10K */
-void movemouse(const Arg *arg)
+void movemouse(const union arg *arg)
{
int x, y, ocx, ocy, nx, ny;
- Client *c;
- Monitor *m;
+ struct client *c;
+ struct monitor *m;
XEvent ev;
if(!(c = selmon->sel)) {
return;
}
-Client *nexttiled(Client *c)
+struct client *nexttiled(struct client *c)
{
for(; c && (c->isfloating || !ISVISIBLE(c)); c = c->next);
return(c);
}
-void pop(Client *c)
+void pop(struct client *c)
{
detach(c);
attach(c);
void propertynotify(XEvent *e)
{
- Client *c;
+ struct client *c;
Window trans;
XPropertyEvent *ev = &e->xproperty;
return;
}
-void quit(const Arg *arg)
+void quit(const union arg *arg)
{
running = False;
return;
}
-Monitor *recttomon(int x, int y, int w, int h)
+struct monitor *recttomon(int x, int y, int w, int h)
{
- Monitor *m, *r = selmon;
- int a, area = 0;
+ struct monitor *m;
+ struct monitor *r;
+ int area;
+
+ r = selmon;
+ area = 0;
for(m = mons; m; m = m->next) {
- if((a = INTERSECT(x, y, w, h, m)) > area) {
+ int a;
+
+ a = INTERSECT(x, y, w, h, m);
+
+ if(a > area) {
area = a;
r = m;
}
return(r);
}
-void removesystrayicon(Client *i)
+void removesystrayicon(struct client *i)
{
- Client **ii;
+ struct client **ii;
if(!showsystray || !i) {
return;
}
-void resize(Client *c, int x, int y, int w, int h, Bool interact)
+void resize(struct client *c, int x, int y, int w, int h, Bool interact)
{
if(applysizehints(c, &x, &y, &w, &h, interact)) {
resizeclient(c, x, y, w, h);
return;
}
-void resizebarwin(Monitor *m)
+void resizebarwin(struct monitor *m)
{
unsigned int w = m->ww;
return;
}
-void resizeclient(Client *c, int x, int y, int w, int h)
+void resizeclient(struct client *c, int x, int y, int w, int h)
{
XWindowChanges wc;
return;
}
-void resizemouse(const Arg *arg)
+void resizemouse(const union arg *arg)
{
int ocx, ocy;
int nw, nh;
- Client *c;
- Monitor *m;
+ struct client *c;
+ struct monitor *m;
XEvent ev;
if(!(c = selmon->sel)) {
void resizerequest(XEvent *e)
{
XResizeRequestEvent *ev = &e->xresizerequest;
- Client *i;
+ struct client *i;
if((i = wintosystrayicon(ev->window))) {
updatesystrayicongeom(i, ev->width, ev->height);
return;
}
-void restack(Monitor *m)
+void restack(struct monitor *m)
{
- Client *c;
+ struct client *c;
XEvent ev;
XWindowChanges wc;
return;
}
-void sendmon(Client *c, Monitor *m)
+void sendmon(struct client *c, struct monitor *m)
{
if(c->mon == m) {
return;
return;
}
-void setclientstate(Client *c, long state)
+void setclientstate(struct client *c, long state)
{
long data[] = { state, None };
return(exists);
}
-void setfocus(Client *c)
+void setfocus(struct client *c)
{
if(!c->neverfocus) {
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
return;
}
-void setfullscreen(Client *c, Bool fullscreen)
+void setfullscreen(struct client *c, Bool fullscreen)
{
if(fullscreen) {
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
return;
}
-void setlayout(const Arg *arg)
+void setlayout(const union 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;
+ selmon->lt[selmon->sellt] = (struct layout*)arg->v;
}
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
#ifndef M10K
/* arg > 1.0 will set mfact absolutly */
-void setmfact(const Arg *arg)
+void setmfact(const union arg *arg)
{
float f;
return;
}
-void showhide(Client *c)
+void showhide(struct client *c)
{
if(!c) {
return;
return;
}
-void spawn(const Arg *arg)
+void spawn(const union arg *arg)
{
if(fork() == 0) {
if(dpy) {
return;
}
-void tag(const Arg *arg)
+void tag(const union arg *arg)
{
if(selmon->sel && arg->ui & TAGMASK) {
selmon->sel->tags = arg->ui & TAGMASK;
return;
}
-void tagmon(const Arg *arg)
+void tagmon(const union arg *arg)
{
if(selmon->sel && mons->next) {
sendmon(selmon->sel, dirtomon(arg->i));
return(r.width / PANGO_SCALE);
}
-void tile(Monitor *m)
+void tile(struct monitor *m)
{
unsigned int i, n, h, mw, my, ty;
- Client *c;
+ struct client *c;
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
return;
}
-static int count_tiled_clients(Monitor *mon)
+static int count_tiled_clients(struct monitor *mon)
{
- Client *tiled;
+ struct client *tiled;
int n;
tiled = nexttiled(mon->clients);
return(n);
}
-static void bookshelf(Monitor *m)
+static void bookshelf(struct monitor *m)
{
int n, w, x;
int extraw;
- Client *c;
+ struct client *c;
n = count_tiled_clients(m);
return;
}
-static void bookstack(Monitor *m)
+static void bookstack(struct monitor *m)
{
int n, h, y;
int extrah;
- Client *c;
+ struct client *c;
/*
* The logic is essentially the same as in bookshelf(), though
}
#ifndef M10K
-void togglebar(const Arg *arg)
+void togglebar(const union arg *arg)
{
selmon->showbar = !selmon->showbar;
updatebarpos(selmon);
}
#endif /* ! M10K */
-void togglefloating(const Arg *arg)
+void togglefloating(const union arg *arg)
{
if(!selmon->sel) {
return;
return;
}
-void toggletag(const Arg *arg)
+void toggletag(const union arg *arg)
{
unsigned int newtags;
return;
}
-void toggleview(const Arg *arg)
+void toggleview(const union arg *arg)
{
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
return;
}
-void unfocus(Client *c, Bool setfocus)
+void unfocus(struct client *c, Bool setfocus)
{
if(!c) {
return;
return;
}
-void unmanage(Client *c, Bool destroyed)
+void unmanage(struct client *c, Bool destroyed)
{
- Monitor *m = c->mon;
+ struct monitor *m = c->mon;
XWindowChanges wc;
/* The server grab construct avoids race conditions. */
void unmapnotify(XEvent *e)
{
- Client *c;
+ struct client *c;
XUnmapEvent *ev = &e->xunmap;
if((c = wintoclient(ev->window))) {
void updatebars(void)
{
unsigned int w;
- Monitor *m;
+ struct monitor *m;
XSetWindowAttributes wa = {
.override_redirect = True,
return;
}
-void updatebarpos(Monitor *m)
+void updatebarpos(struct monitor *m)
{
m->wy = m->my;
m->wh = m->mh;
#ifdef XINERAMA
if(XineramaIsActive(dpy)) {
int i, j, n, nn;
- Client *c;
- Monitor *m;
+ struct client *c;
+ struct monitor *m;
XineramaScreenInfo *info = XineramaQueryScreens(dpy, &nn);
XineramaScreenInfo *unique = NULL;
return;
}
-void updatesizehints(Client *c)
+void updatesizehints(struct client *c)
{
long msize;
XSizeHints size;
return;
}
-void updatetitle(Client *c)
+void updatetitle(struct client *c)
{
if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name)) {
gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name);
return;
}
-void updatesystrayicongeom(Client *i, int w, int h)
+void updatesystrayicongeom(struct client *i, int w, int h)
{
if(i) {
i->h = bh;
return;
}
-void updatesystrayiconstate(Client *i, XPropertyEvent *ev)
+void updatesystrayiconstate(struct client *i, XPropertyEvent *ev)
{
long flags;
int code = 0;
void updatesystray(void)
{
XSetWindowAttributes wa;
- Client *i;
+ struct client *i;
unsigned int x = selmon->mx + selmon->mw;
unsigned int w = 1;
if(!systray) {
/* init systray */
- if(!(systray = (Systray *)calloc(1, sizeof(Systray)))) {
- die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
+ if(!(systray = (struct systray*)calloc(1, sizeof(*systray)))) {
+ die("fatal: could not malloc() %u bytes\n", sizeof(*systray));
}
systray->win = XCreateSimpleWindow(dpy, root, x, selmon->by, w, bh, 0, 0, dc.sel[ColBG]);
return;
}
-void updatewindowtype(Client *c)
+void updatewindowtype(struct client *c)
{
Atom state = getatomprop(c, netatom[NetWMState]);
Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
return;
}
-void updatewmhints(Client *c)
+void updatewmhints(struct client *c)
{
XWMHints *wmh;
return;
}
-void view(const Arg *arg)
+void view(const union arg *arg)
{
if((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) {
return;
return;
}
-Client *wintoclient(Window w)
+struct client *wintoclient(Window w)
{
- Client *c;
- Monitor *m;
+ struct client *c;
+ struct monitor *m;
for(m = mons; m; m = m->next) {
for(c = m->clients; c; c = c->next) {
return(NULL);
}
-Monitor *wintomon(Window w)
+struct monitor *wintomon(Window w)
{
int x, y;
- Client *c;
- Monitor *m;
+ struct client *c;
+ struct monitor *m;
if(w == root && getrootptr(&x, &y)) {
return(recttomon(x, y, 1, 1));
return(selmon);
}
-Client *wintosystrayicon(Window w)
+struct client *wintosystrayicon(Window w)
{
- Client *i = NULL;
+ struct client *i = NULL;
if(!showsystray || !w) {
return(i);
return(-1);
}
-void zoom(const Arg *arg)
+void zoom(const union arg *arg)
{
- Client *c = selmon->sel;
+ struct client *c = selmon->sel;
if(!selmon->lt[selmon->sellt]->arrange ||
(selmon->sel && selmon->sel->isfloating)) {