Remove typedefs

This commit is contained in:
Martin Duquesnoy 2011-09-07 23:03:19 +02:00
parent 90077ffd1c
commit 299fc0bc25
18 changed files with 194 additions and 207 deletions

View File

@ -17,10 +17,10 @@
* \param entermask bool for know if the EnterMask mask is needed * \param entermask bool for know if the EnterMask mask is needed
* \return The BarWindow pointer * \return The BarWindow pointer
*/ */
Barwin* struct Barwin*
barwin_new(Window parent, int x, int y, int w, int h, Color fg, Color bg, bool entermask) barwin_new(Window parent, int x, int y, int w, int h, Color fg, Color bg, bool entermask)
{ {
Barwin *b = (Barwin*)xcalloc(1, sizeof(Barwin)); struct Barwin *b = (struct Barwin*)xcalloc(1, sizeof(struct Barwin));
XSetWindowAttributes at = XSetWindowAttributes at =
{ {
.override_redirect = True, .override_redirect = True,
@ -57,7 +57,7 @@ barwin_new(Window parent, int x, int y, int w, int h, Color fg, Color bg, bool e
* \param bw Barwin pointer * \param bw Barwin pointer
*/ */
void void
barwin_remove(Barwin *b) barwin_remove(struct Barwin *b)
{ {
SLIST_REMOVE(&W->h.barwin, b, Barwin, next); SLIST_REMOVE(&W->h.barwin, b, Barwin, next);
@ -77,7 +77,7 @@ barwin_remove(Barwin *b)
* \param h Height * \param h Height
*/ */
void void
barwin_resize(Barwin *b, int w, int h) barwin_resize(struct Barwin *b, int w, int h)
{ {
/* Frame */ /* Frame */
XFreePixmap(W->dpy, b->dr); XFreePixmap(W->dpy, b->dr);
@ -91,11 +91,11 @@ barwin_resize(Barwin *b, int w, int h)
} }
void void
barwin_mousebind_new(Barwin *b, unsigned int button, bool u, Geo a, void (*func)(Uicb), Uicb cmd) barwin_mousebind_new(struct Barwin *b, unsigned int button, bool u, struct Geo a, void (*func)(Uicb), Uicb cmd)
{ {
Mousebind *m; struct Mousebind *m;
m = xcalloc(1, sizeof(Mousebind)); m = xcalloc(1, sizeof(struct Mousebind));
m->button = button; m->button = button;
m->use_area = u; m->use_area = u;
@ -111,7 +111,7 @@ barwin_mousebind_new(Barwin *b, unsigned int button, bool u, Geo a, void (*func)
* \param bw Barwin pointer * \param bw Barwin pointer
*/ */
void void
barwin_refresh_color(Barwin *b) barwin_refresh_color(struct Barwin *b)
{ {
XSetForeground(W->dpy, W->gc, b->bg); XSetForeground(W->dpy, W->gc, b->bg);
XFillRectangle(W->dpy, b->dr, W->gc, 0, 0, b->geo.w, b->geo.h); XFillRectangle(W->dpy, b->dr, W->gc, 0, 0, b->geo.w, b->geo.h);

View File

@ -23,10 +23,10 @@
#define barwin_map(b) XMapWindow(W->dpy, b->win); #define barwin_map(b) XMapWindow(W->dpy, b->win);
#define barwin_unmap(b) XUnmapWindow(W->dpy, b->win); #define barwin_unmap(b) XUnmapWindow(W->dpy, b->win);
Barwin* barwin_new(Window parent, int x, int y, int w, int h, Color fg, Color bg, bool entermask); struct Barwin* barwin_new(Window parent, int x, int y, int w, int h, Color fg, Color bg, bool entermask);
void barwin_remove(Barwin *b); void barwin_remove(struct Barwin *b);
void barwin_resize(Barwin *b, int w, int h); void barwin_resize(struct Barwin *b, int w, int h);
void barwin_mousebind_new(Barwin *b, unsigned int button, bool u, Geo a, void (*func)(Uicb), Uicb cmd); void barwin_mousebind_new(struct Barwin *b, unsigned int button, bool u, struct Geo a, void (*func)(Uicb), Uicb cmd);
void barwin_refresh_color(Barwin *b); void barwin_refresh_color(struct Barwin *b);
#endif /* BARWIN_H */ #endif /* BARWIN_H */

View File

@ -10,11 +10,11 @@
#define CLIENT_MOUSE_MOD Mod1Mask #define CLIENT_MOUSE_MOD Mod1Mask
/** Send a ConfigureRequest event to the Client /** Send a ConfigureRequest event to the struct Client
* \param c Client pointer * \param c struct Client pointer
*/ */
void void
client_configure(Client *c) client_configure(struct Client *c)
{ {
XConfigureEvent ev; XConfigureEvent ev;
@ -33,10 +33,10 @@ client_configure(Client *c)
XSync(W->dpy, False); XSync(W->dpy, False);
} }
Client* struct Client*
client_gb_win(Window w) client_gb_win(Window w)
{ {
Client *c = SLIST_FIRST(&W->h.client); struct Client *c = SLIST_FIRST(&W->h.client);
while(c && c->win != w) while(c && c->win != w)
c = SLIST_NEXT(c, next); c = SLIST_NEXT(c, next);
@ -45,25 +45,25 @@ client_gb_win(Window w)
} }
/** Map a client /** Map a client
* \param c Client pointer * \param c struct Client pointer
*/ */
void void
client_map(Client *c) client_map(struct Client *c)
{ {
XMapWindow(W->dpy, c->win); XMapWindow(W->dpy, c->win);
} }
/** Unmap a client /** Unmap a client
* \param c Client pointer * \param c struct Client pointer
*/ */
void void
client_unmap(Client *c) client_unmap(struct Client *c)
{ {
XUnmapWindow(W->dpy, c->win); XUnmapWindow(W->dpy, c->win);
} }
static void static void
client_grabbuttons(Client *c, bool focused) client_grabbuttons(struct Client *c, bool focused)
{ {
wmfs_numlockmask(); wmfs_numlockmask();
@ -94,7 +94,7 @@ client_grabbuttons(Client *c, bool focused)
} }
void void
client_focus(Client *c) client_focus(struct Client *c)
{ {
/* Unfocus selected */ /* Unfocus selected */
if(W->client && W->client != c) if(W->client && W->client != c)
@ -121,10 +121,10 @@ client_focus(Client *c)
} }
/** Get a client name /** Get a client name
* \param c Client pointer * \param c struct Client pointer
*/ */
void void
client_get_name(Client *c) client_get_name(struct Client *c)
{ {
Atom rt; Atom rt;
int rf; int rf;
@ -142,10 +142,10 @@ client_get_name(Client *c)
} }
/** Close a client /** Close a client
* \param c Client pointer * \param c struct Client pointer
*/ */
void void
client_close(Client *c) client_close(struct Client *c)
{ {
XEvent ev; XEvent ev;
Atom *atom = NULL; Atom *atom = NULL;
@ -180,12 +180,12 @@ client_close(Client *c)
XKillClient(W->dpy, c->win); XKillClient(W->dpy, c->win);
} }
Client* struct Client*
client_new(Window w, XWindowAttributes *wa) client_new(Window w, XWindowAttributes *wa)
{ {
Client *c; struct Client *c;
c = xcalloc(1, sizeof(Client)); c = xcalloc(1, sizeof(struct Client));
/* C attributes */ /* C attributes */
c->win = w; c->win = w;
@ -195,7 +195,7 @@ client_new(Window w, XWindowAttributes *wa)
/* Set tag */ /* Set tag */
tag_client(W->screen->seltag, c); tag_client(W->screen->seltag, c);
/* Geometry */ /* struct Geometry */
c->geo.x = wa->x; c->geo.x = wa->x;
c->geo.y = wa->y; c->geo.y = wa->y;
c->geo.w = wa->width; c->geo.w = wa->width;
@ -228,9 +228,9 @@ client_new(Window w, XWindowAttributes *wa)
} }
void void
client_remove(Client *c) client_remove(struct Client *c)
{ {
Client *cc; struct Client *cc;
XGrabServer(W->dpy); XGrabServer(W->dpy);
XSetErrorHandler(wmfs_error_handler_dummy); XSetErrorHandler(wmfs_error_handler_dummy);

View File

@ -8,15 +8,15 @@
#include "wmfs.h" #include "wmfs.h"
void client_configure(Client *c); void client_configure(struct Client *c);
Client *client_gb_win(Window w); struct Client *client_gb_win(Window w);
void client_map(Client *c); void client_map(struct Client *c);
void client_unmap(Client *c); void client_unmap(struct Client *c);
void client_focus(Client *c); void client_focus(struct Client *c);
void client_get_name(Client *c); void client_get_name(struct Client *c);
void client_close(Client *c); void client_close(struct Client *c);
Client *client_new(Window w, XWindowAttributes *wa); struct Client *client_new(Window w, XWindowAttributes *wa);
void client_remove(Client *c); void client_remove(struct Client *c);
void client_free(void); void client_free(void);
#endif /* CLIENT_H */ #endif /* CLIENT_H */

View File

@ -16,7 +16,7 @@
static void static void
config_theme(void) config_theme(void)
{ {
Theme *t; struct Theme *t;
size_t i, n; size_t i, n;
struct conf_sec *sec, **ks; struct conf_sec *sec, **ks;
char *name; char *name;
@ -34,7 +34,7 @@ config_theme(void)
/* [theme]*/ /* [theme]*/
for(i = 0; i < n; ++i) for(i = 0; i < n; ++i)
{ {
t = (Theme*)xcalloc(1, sizeof(Theme)); t = (struct Theme*)xcalloc(1, sizeof(struct Theme));
t->name = fetch_opt_first(ks[i], "default", "name").str; t->name = fetch_opt_first(ks[i], "default", "name").str;
@ -73,8 +73,8 @@ config_theme(void)
static void static void
config_bars(void) config_bars(void)
{ {
Scr33n *s; struct Scr33n *s;
Theme *t; struct Theme *t;
size_t i, n; size_t i, n;
struct conf_sec *sec, **ks; struct conf_sec *sec, **ks;
int screenid; int screenid;
@ -96,7 +96,7 @@ config_bars(void)
SLIST_FOREACH(s, &W->h.screen, next) SLIST_FOREACH(s, &W->h.screen, next)
if(screenid == s->id || screenid == -1) if(screenid == s->id || screenid == -1)
(Infobar*)infobar_new(s, t, pos, elem); (struct Infobar*)infobar_new(s, t, pos, elem);
} }
free(ks); free(ks);
@ -106,8 +106,8 @@ config_bars(void)
static void static void
config_tag(void) config_tag(void)
{ {
Scr33n *s; struct Scr33n *s;
Tag *t; struct Tag *t;
size_t i, n; size_t i, n;
struct conf_sec *sec, **ks; struct conf_sec *sec, **ks;
char *name; char *name;
@ -146,7 +146,7 @@ config_keybind(void)
struct conf_sec *sec, **ks; struct conf_sec *sec, **ks;
struct opt_type *opt; struct opt_type *opt;
char *cmd; char *cmd;
Keybind *k; struct Keybind *k;
/* [keys] */ /* [keys] */
sec = fetch_section_first(NULL, "keys"); sec = fetch_section_first(NULL, "keys");
@ -158,7 +158,7 @@ config_keybind(void)
/* [key] */ /* [key] */
for(i = 0; i < n; ++i) for(i = 0; i < n; ++i)
{ {
k = (Keybind*)xcalloc(1, sizeof(Keybind)); k = (struct Keybind*)xcalloc(1, sizeof(struct Keybind));
/* mod = {} */ /* mod = {} */
opt = fetch_opt(ks[i], "", "mod"); opt = fetch_opt(ks[i], "", "mod");

View File

@ -71,10 +71,10 @@ modkey_keysym(const char *name)
return NoSymbol; return NoSymbol;
} }
static inline Theme* static inline struct Theme*
name_to_theme(const char *name) name_to_theme(const char *name)
{ {
Theme *t; struct Theme *t;
SLIST_FOREACH(t, &W->h.theme, next) SLIST_FOREACH(t, &W->h.theme, next)
if(!strcmp(t->name, name)) if(!strcmp(t->name, name))

View File

@ -16,14 +16,14 @@
#define PAD (8) #define PAD (8)
static inline void static inline void
draw_text(Drawable d, Theme *t, int x, int y, Color fg, const char *str) draw_text(Drawable d, struct Theme *t, int x, int y, Color fg, const char *str)
{ {
XSetForeground(W->dpy, W->gc, fg); XSetForeground(W->dpy, W->gc, fg);
XmbDrawString(W->dpy, d, t->font.fontset, W->gc, x, y, str, strlen(str)); XmbDrawString(W->dpy, d, t->font.fontset, W->gc, x, y, str, strlen(str));
} }
static inline unsigned short static inline unsigned short
draw_textw(Theme *t, const char *str) draw_textw(struct Theme *t, const char *str)
{ {
XRectangle r; XRectangle r;

View File

@ -16,8 +16,8 @@ static void
event_buttonpress(XEvent *e) event_buttonpress(XEvent *e)
{ {
XButtonEvent *ev = &e->xbutton; XButtonEvent *ev = &e->xbutton;
Mousebind *m; struct Mousebind *m;
Barwin *b; struct Barwin *b;
screen_update_sel(); screen_update_sel();
@ -38,7 +38,7 @@ static void
event_enternotify(XEvent *e) event_enternotify(XEvent *e)
{ {
XCrossingEvent *ev = &e->xcrossing; XCrossingEvent *ev = &e->xcrossing;
Client *c; struct Client *c;
if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) if((ev->mode != NotifyNormal || ev->detail == NotifyInferior)
&& ev->window != W->root) && ev->window != W->root)
@ -60,7 +60,7 @@ event_configureevent(XEvent *e)
{ {
XConfigureRequestEvent *ev = &e->xconfigurerequest; XConfigureRequestEvent *ev = &e->xconfigurerequest;
XWindowChanges wc; XWindowChanges wc;
Client *c; struct Client *c;
if((c = client_gb_win(ev->window))) if((c = client_gb_win(ev->window)))
{ {
@ -95,7 +95,7 @@ static void
event_destroynotify(XEvent *e) event_destroynotify(XEvent *e)
{ {
XDestroyWindowEvent *ev = &e->xdestroywindow; XDestroyWindowEvent *ev = &e->xdestroywindow;
Client *c; struct Client *c;
if((c = client_gb_win(ev->window))) if((c = client_gb_win(ev->window)))
client_remove(c); client_remove(c);
@ -104,7 +104,7 @@ event_destroynotify(XEvent *e)
static void static void
event_focusin(XEvent *e) event_focusin(XEvent *e)
{ {
Client *c; struct Client *c;
if(W->client && e->xfocus.window != W->client->win) if(W->client && e->xfocus.window != W->client->win)
client_focus(W->client); client_focus(W->client);
@ -122,7 +122,7 @@ event_maprequest(XEvent *e)
return; return;
if(!client_gb_win(ev->window)) if(!client_gb_win(ev->window))
(Client*)client_new(ev->window, &at); (struct Client*)client_new(ev->window, &at);
} }
static void static void
@ -139,7 +139,7 @@ static void
event_propertynotify(XEvent *e) event_propertynotify(XEvent *e)
{ {
XPropertyEvent *ev = &e->xproperty; XPropertyEvent *ev = &e->xproperty;
Client *c; struct Client *c;
if(ev->state == PropertyDelete) if(ev->state == PropertyDelete)
return; return;
@ -176,7 +176,7 @@ static void
event_unmapnotify(XEvent *e) event_unmapnotify(XEvent *e)
{ {
XUnmapEvent *ev = &e->xunmap; XUnmapEvent *ev = &e->xunmap;
Client *c; struct Client *c;
if((c = client_gb_win(ev->window)) && ev->send_event) if((c = client_gb_win(ev->window)) && ev->send_event)
client_remove(c); client_remove(c);
@ -201,7 +201,7 @@ event_keypress(XEvent *e)
{ {
XKeyPressedEvent *ev = &e->xkey; XKeyPressedEvent *ev = &e->xkey;
KeySym keysym = XKeycodeToKeysym(EVDPY(e), (KeyCode)ev->keycode, 0); KeySym keysym = XKeycodeToKeysym(EVDPY(e), (KeyCode)ev->keycode, 0);
Keybind *k; struct Keybind *k;
screen_update_sel(); screen_update_sel();
@ -215,7 +215,7 @@ static void
event_expose(XEvent *e) event_expose(XEvent *e)
{ {
XExposeEvent *ev = &e->xexpose; XExposeEvent *ev = &e->xexpose;
Barwin *b; struct Barwin *b;
SLIST_FOREACH(b, &W->h.barwin, next) SLIST_FOREACH(b, &W->h.barwin, next)
if(b->win == ev->window) if(b->win == ev->window)

View File

@ -9,11 +9,11 @@
#include "tag.h" #include "tag.h"
#include "util.h" #include "util.h"
Frame* struct Frame*
frame_new(Tag *t) frame_new(struct Tag *t)
{ {
Geo g = t->screen->ugeo; struct Geo g = t->screen->ugeo;
Frame *f = xcalloc(1, sizeof(Frame)); struct Frame *f = xcalloc(1, sizeof(struct Frame));
XSetWindowAttributes at = XSetWindowAttributes at =
{ {
.override_redirect = True, .override_redirect = True,
@ -34,7 +34,7 @@ frame_new(Tag *t)
} }
static void static void
frame_remove(Frame *f) frame_remove(struct Frame *f)
{ {
SLIST_REMOVE(&f->tag->frames, f, Frame, next); SLIST_REMOVE(&f->tag->frames, f, Frame, next);
XDestroyWindow(W->dpy, f->win); XDestroyWindow(W->dpy, f->win);
@ -44,16 +44,16 @@ frame_remove(Frame *f)
} }
void void
frame_free(Tag *t) frame_free(struct Tag *t)
{ {
Frame *f; struct Frame *f;
SLIST_FOREACH(f, &t->frames, next) SLIST_FOREACH(f, &t->frames, next)
frame_remove(f); frame_remove(f);
} }
void void
frame_client(Frame *f, Client *c) frame_client(struct Frame *f, struct Client *c)
{ {
/* Remove client from its previous frame */ /* Remove client from its previous frame */
if(c->frame) if(c->frame)
@ -71,7 +71,7 @@ frame_client(Frame *f, Client *c)
} }
void void
frame_update(Frame *f) frame_update(struct Frame *f)
{ {
} }

View File

@ -8,8 +8,8 @@
#include "wmfs.h" #include "wmfs.h"
Frame *frame_new(Tag *t); struct Frame *frame_new(struct Tag *t);
void frame_free(Tag *t); void frame_free(struct Tag *t);
void frame_update(Frame *f); void frame_update(struct Frame *f);
#endif /* FRAME_H */ #endif /* FRAME_H */

View File

@ -10,14 +10,14 @@
#include "util.h" #include "util.h"
#include "tag.h" #include "tag.h"
static void infobar_elem_tag_init(Element *e); static void infobar_elem_tag_init(struct Element *e);
static void infobar_elem_tag_update(Element *e); static void infobar_elem_tag_update(struct Element *e);
const struct elem_funcs const struct elem_funcs
{ {
char c; char c;
void (*func_init)(Element *e); void (*func_init)(struct Element *e);
void (*func_update)(Element *e); void (*func_update)(struct Element *e);
} elem_funcs[] = } elem_funcs[] =
{ {
{ 't', infobar_elem_tag_init, infobar_elem_tag_update }, { 't', infobar_elem_tag_init, infobar_elem_tag_update },
@ -30,11 +30,11 @@ const struct elem_funcs
}; };
static void static void
infobar_elem_tag_init(Element *e) infobar_elem_tag_init(struct Element *e)
{ {
Tag *t; struct Tag *t;
Barwin *b, *prev; struct Barwin *b, *prev;
Geo g = { 0, 0, 0, 0 }; struct Geo g = { 0, 0, 0, 0 };
int s, j; int s, j;
infobar_elem_placement(e); infobar_elem_placement(e);
@ -80,14 +80,14 @@ infobar_elem_tag_init(Element *e)
} }
static void static void
infobar_elem_tag_update(Element *e) infobar_elem_tag_update(struct Element *e)
{ {
Tag *t, *sel = e->infobar->screen->seltag; struct Tag *t, *sel = e->infobar->screen->seltag;
Barwin *b; struct Barwin *b;
SLIST_FOREACH(b, &e->bars, enext) SLIST_FOREACH(b, &e->bars, enext)
{ {
t = (Tag*)b->ptr; t = (struct Tag*)b->ptr;
/* Selected */ /* Selected */
/* TODO: color from conf */ /* TODO: color from conf */
@ -112,9 +112,9 @@ infobar_elem_tag_update(Element *e)
} }
static void static void
infobar_elem_init(Infobar *i) infobar_elem_init(struct Infobar *i)
{ {
Element *e; struct Element *e;
int n, j; int n, j;
TAILQ_INIT(&i->elements); TAILQ_INIT(&i->elements);
@ -124,7 +124,7 @@ infobar_elem_init(Infobar *i)
for(j = 0; j < LEN(elem_funcs); ++j) for(j = 0; j < LEN(elem_funcs); ++j)
if(elem_funcs[j].c == i->elemorder[n]) if(elem_funcs[j].c == i->elemorder[n])
{ {
e = xcalloc(1, sizeof(Element)); e = xcalloc(1, sizeof(struct Element));
SLIST_INIT(&e->bars); SLIST_INIT(&e->bars);
@ -143,9 +143,9 @@ infobar_elem_init(Infobar *i)
} }
void void
infobar_elem_update(Infobar *i) infobar_elem_update(struct Infobar *i)
{ {
Element *e; struct Element *e;
TAILQ_FOREACH(e, &i->elements, next) TAILQ_FOREACH(e, &i->elements, next)
if(i->screen->elemupdate & FLAGINT(e->type)) if(i->screen->elemupdate & FLAGINT(e->type))
@ -153,9 +153,9 @@ infobar_elem_update(Infobar *i)
} }
void void
infobar_elem_remove(Element *e) infobar_elem_remove(struct Element *e)
{ {
Barwin *b; struct Barwin *b;
TAILQ_REMOVE(&e->infobar->elements, e, next); TAILQ_REMOVE(&e->infobar->elements, e, next);
@ -167,13 +167,13 @@ infobar_elem_remove(Element *e)
} }
} }
Infobar* struct Infobar*
infobar_new(Scr33n *s, Theme *theme, Barpos pos, const char *elem) infobar_new(struct Scr33n *s, struct Theme *theme, Barpos pos, const char *elem)
{ {
bool map; bool map;
int n; int n;
Infobar *i = (Infobar*)xcalloc(1, sizeof(Infobar)); struct Infobar *i = (struct Infobar*)xcalloc(1, sizeof(struct Infobar));
i->screen = s; i->screen = s;
i->theme = theme; i->theme = theme;
@ -181,13 +181,13 @@ infobar_new(Scr33n *s, Theme *theme, Barpos pos, const char *elem)
map = infobar_placement(i, pos); map = infobar_placement(i, pos);
/* Barwin create */ /* struct Barwin create */
i->bar = barwin_new(W->root, i->geo.x, i->geo.y, i->geo.w, i->geo.h, i->bar = barwin_new(W->root, i->geo.x, i->geo.y, i->geo.w, i->geo.h,
theme->bars.fg, theme->bars.bg, false); theme->bars.fg, theme->bars.bg, false);
SLIST_INSERT_HEAD(&s->infobars, i, next); SLIST_INSERT_HEAD(&s->infobars, i, next);
/* Elements */ /* struct Elements */
infobar_elem_init(i); infobar_elem_init(i);
/* Render, only if pos is Top or Bottom */ /* Render, only if pos is Top or Bottom */
@ -203,7 +203,7 @@ infobar_new(Scr33n *s, Theme *theme, Barpos pos, const char *elem)
} }
void void
infobar_refresh(Infobar *i) infobar_refresh(struct Infobar *i)
{ {
infobar_elem_update(i); infobar_elem_update(i);
@ -211,9 +211,9 @@ infobar_refresh(Infobar *i)
} }
void void
infobar_remove(Infobar *i) infobar_remove(struct Infobar *i)
{ {
Element *e; struct Element *e;
free(i->elemorder); free(i->elemorder);
@ -228,9 +228,9 @@ infobar_remove(Infobar *i)
} }
void void
infobar_free(Scr33n *s) infobar_free(struct Scr33n *s)
{ {
Infobar *i; struct Infobar *i;
while(!SLIST_EMPTY(&s->infobars)) while(!SLIST_EMPTY(&s->infobars))
{ {

View File

@ -12,17 +12,17 @@
enum { ElemTag = 0, ElemLayout, ElemSelbar, ElemStatus, ElemCustom, ElemLast }; enum { ElemTag = 0, ElemLayout, ElemSelbar, ElemStatus, ElemCustom, ElemLast };
Infobar *infobar_new(Scr33n *s, Theme *theme, Barpos pos, const char *elem); struct Infobar *infobar_new(struct Scr33n *s, struct Theme *theme, Barpos pos, const char *elem);
void infobar_elem_update(Infobar *i); void infobar_elem_update(struct Infobar *i);
void infobar_refresh(Infobar *i); void infobar_refresh(struct Infobar *i);
void infobar_remove(Infobar *i); void infobar_remove(struct Infobar *i);
void infobar_free(Scr33n *s); void infobar_free(struct Scr33n *s);
/* Basic placement of elements */ /* Basic placement of elements */
static inline void static inline void
infobar_elem_placement(Element *e) infobar_elem_placement(struct Element *e)
{ {
Element *p = TAILQ_PREV(e, esub, next); struct Element *p = TAILQ_PREV(e, esub, next);
e->geo.y = e->geo.w = 0; e->geo.y = e->geo.w = 0;
e->geo.h = e->infobar->geo.h; e->geo.h = e->infobar->geo.h;
@ -31,7 +31,7 @@ infobar_elem_placement(Element *e)
/* Bars placement management and usable space management */ /* Bars placement management and usable space management */
static inline bool static inline bool
infobar_placement(Infobar *i, Barpos p) infobar_placement(struct Infobar *i, Barpos p)
{ {
i->pos = p; i->pos = p;
i->geo = i->screen->ugeo; i->geo = i->screen->ugeo;
@ -56,9 +56,9 @@ infobar_placement(Infobar *i, Barpos p)
} }
static inline void static inline void
infobar_elem_screen_update(Scr33n *s, int addf) infobar_elem_screen_update(struct Scr33n *s, int addf)
{ {
Infobar *i; struct Infobar *i;
s->elemupdate |= FLAGINT(addf); s->elemupdate |= FLAGINT(addf);

View File

@ -14,10 +14,10 @@
#include "tag.h" #include "tag.h"
#include "infobar.h" #include "infobar.h"
static Scr33n* static struct Scr33n*
screen_new(Geo *g, int id) screen_new(struct Geo *g, int id)
{ {
Scr33n *s = (Scr33n*)xcalloc(1, sizeof(Scr33n)); struct Scr33n *s = (struct Scr33n*)xcalloc(1, sizeof(struct Scr33n));
s->geo = s->ugeo = *g; s->geo = s->ugeo = *g;
s->seltag = NULL; s->seltag = NULL;
@ -37,8 +37,8 @@ screen_new(Geo *g, int id)
void void
screen_init(void) screen_init(void)
{ {
Scr33n *s; struct Scr33n *s;
Geo g; struct Geo g;
SLIST_INIT(&W->h.screen); SLIST_INIT(&W->h.screen);
@ -76,13 +76,13 @@ screen_init(void)
/* /*
* Update selected screen with mouse location * Update selected screen with mouse location
*/ */
Scr33n* struct Scr33n*
screen_update_sel(void) screen_update_sel(void)
{ {
#ifdef HAVE_XINERAMA #ifdef HAVE_XINERAMA
if(XineramaIsActive(W->dpy)) if(XineramaIsActive(W->dpy))
{ {
Scr33n *s; struct Scr33n *s;
Window w; Window w;
int d, x, y; int d, x, y;
@ -100,12 +100,13 @@ screen_update_sel(void)
void void
screen_free(void) screen_free(void)
{ {
Scr33n *s; struct Scr33n *s;
while(!SLIST_EMPTY(&W->h.screen)) while(!SLIST_EMPTY(&W->h.screen))
{ {
s = SLIST_FIRST(&W->h.screen); s = SLIST_FIRST(&W->h.screen);
SLIST_REMOVE_HEAD(&W->h.screen, next); SLIST_REMOVE_HEAD(&W->h.screen, next);
infobar_free(s); infobar_free(s);
tag_free(s); tag_free(s);
free(s); free(s);

View File

@ -8,10 +8,10 @@
#include "wmfs.h" #include "wmfs.h"
static inline Scr33n* static inline struct Scr33n*
screen_gb_id(int id) screen_gb_id(int id)
{ {
Scr33n *s; struct Scr33n *s;
SLIST_FOREACH(s, &W->h.screen, next) SLIST_FOREACH(s, &W->h.screen, next)
if(s->id == id) if(s->id == id)
@ -21,7 +21,7 @@ screen_gb_id(int id)
} }
void screen_init(void); void screen_init(void);
Scr33n* screen_update_sel(void); struct Scr33n* screen_update_sel(void);
void screen_free(void); void screen_free(void);
#endif /* SCREEN_H */ #endif /* SCREEN_H */

View File

@ -9,12 +9,12 @@
#include "client.h" #include "client.h"
#include "frame.h" #include "frame.h"
Tag* struct Tag*
tag_new(Scr33n *s, char *name) tag_new(struct Scr33n *s, char *name)
{ {
Tag *t; struct Tag *t;
t = xcalloc(1, sizeof(Tag)); t = xcalloc(1, sizeof(struct Tag));
t->screen = s; t->screen = s;
t->name = xstrdup(name); t->name = xstrdup(name);
@ -35,10 +35,10 @@ tag_new(Scr33n *s, char *name)
} }
void void
tag_screen(Scr33n *s, Tag *t) tag_screen(struct Scr33n *s, struct Tag *t)
{ {
Frame *f; struct Frame *f;
Client *c; struct Client *c;
/* Hide previous tag's clients */ /* Hide previous tag's clients */
if(s->seltag) if(s->seltag)
@ -60,7 +60,7 @@ tag_screen(Scr33n *s, Tag *t)
} }
void void
tag_client(Tag *t, Client *c) tag_client(struct Tag *t, struct Client *c)
{ {
/* Remove client from its previous tag */ /* Remove client from its previous tag */
if(c->tag) if(c->tag)
@ -84,7 +84,7 @@ void
uicb_tag_set(Uicb cmd) uicb_tag_set(Uicb cmd)
{ {
int i = 0, n = ATOI(cmd); int i = 0, n = ATOI(cmd);
Tag *t; struct Tag *t;
TAILQ_FOREACH(t, &W->screen->tags, next) TAILQ_FOREACH(t, &W->screen->tags, next)
if(++i == n) if(++i == n)
@ -97,7 +97,7 @@ uicb_tag_set(Uicb cmd)
void void
uicb_tag_set_with_name(Uicb cmd) uicb_tag_set_with_name(Uicb cmd)
{ {
Tag *t; struct Tag *t;
TAILQ_FOREACH(t, &W->screen->tags, next) TAILQ_FOREACH(t, &W->screen->tags, next)
if(!strcmp(cmd, t->name)) if(!strcmp(cmd, t->name))
@ -111,7 +111,7 @@ void
uicb_tag_next(Uicb cmd) uicb_tag_next(Uicb cmd)
{ {
(void)cmd; (void)cmd;
Tag *t; struct Tag *t;
if((t = TAILQ_NEXT(W->screen->seltag, next))) if((t = TAILQ_NEXT(W->screen->seltag, next)))
tag_screen(W->screen, t); tag_screen(W->screen, t);
@ -123,7 +123,7 @@ void
uicb_tag_prev(Uicb cmd) uicb_tag_prev(Uicb cmd)
{ {
(void)cmd; (void)cmd;
Tag *t; struct Tag *t;
if((t = TAILQ_PREV(W->screen->seltag, tsub, next))) if((t = TAILQ_PREV(W->screen->seltag, tsub, next)))
tag_screen(W->screen, t); tag_screen(W->screen, t);
@ -132,9 +132,9 @@ uicb_tag_prev(Uicb cmd)
} }
static void static void
tag_remove(Tag *t) tag_remove(struct Tag *t)
{ {
Frame *f; struct Frame *f;
free(t->name); free(t->name);
@ -145,9 +145,9 @@ tag_remove(Tag *t)
void void
tag_free(Scr33n *s) tag_free(struct Scr33n *s)
{ {
Tag *t; struct Tag *t;
TAILQ_FOREACH(t, &s->tags, next) TAILQ_FOREACH(t, &s->tags, next)
{ {

View File

@ -8,16 +8,13 @@
#include "wmfs.h" #include "wmfs.h"
Tag *tag_new(Scr33n *s, char *name); struct Tag *tag_new(struct Scr33n *s, char *name);
void tag_screen(Scr33n *s, Tag *t); void tag_screen(struct Scr33n *s, struct Tag *t);
void tag_client(Tag *t, Client *c); void tag_client(struct Tag *t, struct Client *c);
void tag_free(Scr33n *s); void tag_free(struct Scr33n *s);
void uicb_tag_set(Uicb cmd); void uicb_tag_set(Uicb cmd);
void uicb_tag_set_with_name(Uicb cmd); void uicb_tag_set_with_name(Uicb cmd);
void uicb_tag_next(Uicb cmd); void uicb_tag_next(Uicb cmd);
void uicb_tag_prev(Uicb cmd); void uicb_tag_prev(Uicb cmd);
#endif /* TAG_H */ #endif /* TAG_H */

View File

@ -73,7 +73,7 @@ wmfs_numlockmask(void)
} }
void void
wmfs_init_font(char *font, Theme *t) wmfs_init_font(char *font, struct Theme *t)
{ {
XFontStruct **xfs = NULL; XFontStruct **xfs = NULL;
char **misschar, **names, *defstring; char **misschar, **names, *defstring;
@ -150,7 +150,7 @@ void
wmfs_grab_keys(void) wmfs_grab_keys(void)
{ {
KeyCode c; KeyCode c;
Keybind *k; struct Keybind *k;
wmfs_numlockmask(); wmfs_numlockmask();
@ -252,8 +252,8 @@ wmfs_init(void)
void void
wmfs_quit(void) wmfs_quit(void)
{ {
Keybind *k; struct Keybind *k;
Theme *t; struct Theme *t;
/* Will free: /* Will free:
* *

View File

@ -36,58 +36,47 @@ typedef enum { Right = 0, Left, Top, Bottom, Center, PositionLast } Position;
/* /*
* Structures * Structures
*/ */
typedef struct Geo Geo;
typedef struct Element Element;
typedef struct Infobar Infobar;
typedef struct Barwin Barwin;
typedef struct Scr33n Scr33n;
typedef struct Tag Tag;
typedef struct Client Client;
typedef struct Frame Frame;
typedef struct Keybind Keybind;
typedef struct Mousebind Mousebind;
typedef struct Theme Theme;
struct Geo struct Geo
{ {
int x, y, w, h; int x, y, w, h;
}; };
/* Barwin */ /* struct Barwin */
struct Barwin struct Barwin
{ {
struct Geo geo;
Window win; Window win;
Drawable dr; Drawable dr;
Color fg, bg; Color fg, bg;
Geo geo; Flags flags;
Flags flags;
void *ptr; /* Special cases */ void *ptr; /* Special cases */
SLIST_HEAD(, Mousebind) mousebinds; SLIST_HEAD(, Mousebind) mousebinds;
SLIST_ENTRY(Barwin) next; /* global barwin */ SLIST_ENTRY(Barwin) next; /* global barwin */
SLIST_ENTRY(Barwin) enext; /* element barwin */ SLIST_ENTRY(Barwin) enext; /* element barwin */
}; };
/* Infobar's element */ /* struct Infobar's element */
struct Element struct Element
{ {
SLIST_HEAD(, Barwin) bars; struct Geo geo;
Geo geo; struct Infobar *infobar;
Infobar *infobar;
int type; int type;
void (*func_init)(Element *e); void (*func_init)(struct Element *e);
void (*func_update)(Element *e); void (*func_update)(struct Element *e);
SLIST_HEAD(, Barwin) bars;
TAILQ_ENTRY(Element) next; TAILQ_ENTRY(Element) next;
}; };
/* Infobar */ /* struct Infobar */
struct Infobar struct Infobar
{ {
Barwin *bar; struct Barwin *bar;
Geo geo; struct Geo geo;
Barpos pos; struct Scr33n *screen;
Scr33n *screen; struct Theme *theme;
Theme *theme;
char *elemorder; char *elemorder;
Barpos pos;
TAILQ_HEAD(esub, Element) elements; TAILQ_HEAD(esub, Element) elements;
SLIST_ENTRY(Infobar) next; SLIST_ENTRY(Infobar) next;
}; };
@ -95,8 +84,8 @@ struct Infobar
/* Screen */ /* Screen */
struct Scr33n struct Scr33n
{ {
Geo geo, ugeo; struct Geo geo, ugeo;
Tag *seltag; struct Tag *seltag;
int id; int id;
Flags elemupdate; Flags elemupdate;
TAILQ_HEAD(tsub, Tag) tags; TAILQ_HEAD(tsub, Tag) tags;
@ -104,40 +93,40 @@ struct Scr33n
SLIST_ENTRY(Scr33n) next; SLIST_ENTRY(Scr33n) next;
}; };
/* Tag */ /* struct Tag */
struct Tag struct Tag
{ {
struct Scr33n *screen;
struct Client *sel;
struct Frame *frame;
char *name; char *name;
Scr33n *screen;
Flags flags; Flags flags;
Client *sel;
Frame *frame;
SLIST_HEAD(, Frame) frames; SLIST_HEAD(, Frame) frames;
SLIST_HEAD(, Client) clients; SLIST_HEAD(, Client) clients;
TAILQ_ENTRY(Tag) next; TAILQ_ENTRY(Tag) next;
}; };
/* Client */ /* struct Client */
struct Client struct Client
{ {
Tag *tag; struct Tag *tag;
Scr33n *screen; struct Scr33n *screen;
Frame *frame; struct Frame *frame;
Barwin *titlebar; struct Barwin *titlebar;
Geo geo; struct Geo geo;
Flags flags;
char *title; char *title;
Flags flags;
Window win; Window win;
SLIST_ENTRY(Client) next; /* Global list */ SLIST_ENTRY(Client) next; /* Global list */
SLIST_ENTRY(Client) tnext; /* Tag list */ SLIST_ENTRY(Client) tnext; /* struct Tag list */
SLIST_ENTRY(Client) fnext; /* Frame list */ SLIST_ENTRY(Client) fnext; /* struct struct Frame list */
}; };
/* Frame */ /* struct struct Frame */
struct Frame struct Frame
{ {
Tag *tag; struct Tag *tag;
Geo geo; struct Geo geo;
Window win; Window win;
Color fg, bg; Color fg, bg;
SLIST_HEAD(, Client) clients; SLIST_HEAD(, Client) clients;
@ -148,16 +137,16 @@ struct Frame
struct Keybind struct Keybind
{ {
unsigned int mod; unsigned int mod;
KeySym keysym;
void (*func)(Uicb); void (*func)(Uicb);
Uicb cmd; Uicb cmd;
KeySym keysym;
SLIST_ENTRY(Keybind) next; SLIST_ENTRY(Keybind) next;
}; };
struct Mousebind struct Mousebind
{ {
struct Geo area;
unsigned int button; unsigned int button;
Geo area;
bool use_area; bool use_area;
void (*func)(Uicb); void (*func)(Uicb);
Uicb cmd; Uicb cmd;
@ -184,12 +173,12 @@ struct Theme
struct Colpair bars; struct Colpair bars;
int bars_width; int bars_width;
/* Elements */ /* struct Elements */
struct Colpair tags_n, tags_s; /* normal / selected */ struct Colpair tags_n, tags_s; /* normal / selected */
int tags_border_width; int tags_border_width;
Color tags_border_col; Color tags_border_col;
/* Client / Frame */ /* struct Client / struct struct Frame */
struct Colpair client_n, client_s; struct Colpair client_n, client_s;
Color frame_bg; Color frame_bg;
int client_titlebar_width; int client_titlebar_width;
@ -223,8 +212,8 @@ struct Wmfs
/* /*
* Selected screen, client * Selected screen, client
*/ */
Scr33n *screen; struct Scr33n *screen;
Client *client; struct Client *client;
}; };
@ -232,7 +221,7 @@ int wmfs_error_handler(Display *d, XErrorEvent *event);
int wmfs_error_handler_dummy(Display *d, XErrorEvent *event); int wmfs_error_handler_dummy(Display *d, XErrorEvent *event);
void wmfs_grab_keys(void); void wmfs_grab_keys(void);
void wmfs_numlockmask(void); void wmfs_numlockmask(void);
void wmfs_init_font(char *font, Theme *t); void wmfs_init_font(char *font, struct Theme *t);
void wmfs_quit(void); void wmfs_quit(void);
void uicb_reload(Uicb cmd); void uicb_reload(Uicb cmd);
void uicb_quit(Uicb cmd); void uicb_quit(Uicb cmd);