Better organize DWM included files
This commit is contained in:
parent
f90668bbd1
commit
4b424b1dfd
10 changed files with 79 additions and 32 deletions
5
Makefile
5
Makefile
|
@ -6,6 +6,9 @@ include config.mk
|
||||||
SRC = atoms.c drw.c dwm.c helpers.c layouts.c settings.c spawn.c tags.c util.c
|
SRC = atoms.c drw.c dwm.c helpers.c layouts.c settings.c spawn.c tags.c util.c
|
||||||
OBJ = ${SRC:.c=.o}
|
OBJ = ${SRC:.c=.o}
|
||||||
|
|
||||||
|
DWM_SRC = dwm/handlers.c dwm/layouts.c dwm/swallow.c dwm/systray.c
|
||||||
|
DWM_HDR = ${DWM_SRC:.c=.h}
|
||||||
|
|
||||||
all: options polytreewm
|
all: options polytreewm
|
||||||
|
|
||||||
options:
|
options:
|
||||||
|
@ -17,7 +20,7 @@ options:
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
${CC} -c $< -o $@ ${CFLAGS}
|
${CC} -c $< -o $@ ${CFLAGS}
|
||||||
|
|
||||||
dwm.o: dwm/handlers.c dwm/layouts.c dwm/swallow.c dwm/systray.c
|
dwm.o: ${DWM_SRC} ${DWM_HDR}
|
||||||
${OBJ}: atoms.h drw.h config.def.h config.mk helpers.h layouts.h settings.h spawn.h tags.h util.h
|
${OBJ}: atoms.h drw.h config.def.h config.mk helpers.h layouts.h settings.h spawn.h tags.h util.h
|
||||||
|
|
||||||
polytreewm: ${OBJ}
|
polytreewm: ${OBJ}
|
||||||
|
|
35
dwm.c
35
dwm.c
|
@ -184,7 +184,6 @@ static void attach(Client *c);
|
||||||
static void attachstack(Client *c);
|
static void attachstack(Client *c);
|
||||||
static void configborder(const Arg *arg);
|
static void configborder(const Arg *arg);
|
||||||
static void configgap(const Arg *arg);
|
static void configgap(const Arg *arg);
|
||||||
static void centeredmaster(Monitor *m);
|
|
||||||
static void checkotherwm(void);
|
static void checkotherwm(void);
|
||||||
static void cleanup(void);
|
static void cleanup(void);
|
||||||
static void cleanupmon(Monitor *mon);
|
static void cleanupmon(Monitor *mon);
|
||||||
|
@ -201,15 +200,12 @@ static void focusstack(const Arg *arg);
|
||||||
static Atom getatomprop(Client *c, Atom prop);
|
static Atom getatomprop(Client *c, Atom prop);
|
||||||
static int getrootptr(int *x, int *y);
|
static int getrootptr(int *x, int *y);
|
||||||
static long getstate(Window w);
|
static long getstate(Window w);
|
||||||
static unsigned int getsystraywidth();
|
|
||||||
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||||
static void grabbuttons(Client *c, int focused);
|
static void grabbuttons(Client *c, int focused);
|
||||||
static void grabkeys(void);
|
static void grabkeys(void);
|
||||||
static void horizontile(Monitor *);
|
|
||||||
static void incnmaster(const Arg *arg);
|
static void incnmaster(const Arg *arg);
|
||||||
static void killclient(const Arg *arg);
|
static void killclient(const Arg *arg);
|
||||||
static void manage(Window w, XWindowAttributes *wa);
|
static void manage(Window w, XWindowAttributes *wa);
|
||||||
static void monocle(Monitor *m);
|
|
||||||
static void movemouse(const Arg *arg);
|
static void movemouse(const Arg *arg);
|
||||||
static void movestack(const Arg *arg);
|
static void movestack(const Arg *arg);
|
||||||
static void nametag(const Arg *arg);
|
static void nametag(const Arg *arg);
|
||||||
|
@ -217,7 +213,6 @@ static Client *nexttiled(Client *c);
|
||||||
static void pop(Client *);
|
static void pop(Client *);
|
||||||
static void quit(const Arg *arg);
|
static void quit(const Arg *arg);
|
||||||
static Monitor *recttomon(int x, int y, int w, int h);
|
static Monitor *recttomon(int x, int y, int w, int h);
|
||||||
static void removesystrayicon(Client *i);
|
|
||||||
static void resetnmaster(const Arg *arg);
|
static void resetnmaster(const Arg *arg);
|
||||||
static void resize(Client *c, int x, int y, int w, int h, int bw, int interact);
|
static void resize(Client *c, int x, int y, int w, int h, int bw, int interact);
|
||||||
static void resizebarwin(Monitor *m);
|
static void resizebarwin(Monitor *m);
|
||||||
|
@ -239,10 +234,8 @@ static void showhide(Client *c);
|
||||||
static void sigchld(int unused);
|
static void sigchld(int unused);
|
||||||
static void spawn(const Arg *arg);
|
static void spawn(const Arg *arg);
|
||||||
static void spawn_callback();
|
static void spawn_callback();
|
||||||
static Monitor *systraytomon(Monitor *m);
|
|
||||||
static void tag(const Arg *arg);
|
static void tag(const Arg *arg);
|
||||||
static void tagmon(const Arg *arg);
|
static void tagmon(const Arg *arg);
|
||||||
static void tile(Monitor *);
|
|
||||||
static void togglebar(const Arg *arg);
|
static void togglebar(const Arg *arg);
|
||||||
static void togglefloating(const Arg *arg);
|
static void togglefloating(const Arg *arg);
|
||||||
static void toggletag(const Arg *arg);
|
static void toggletag(const Arg *arg);
|
||||||
|
@ -256,9 +249,6 @@ static int updategeom(void);
|
||||||
static void updatenumlockmask(void);
|
static void updatenumlockmask(void);
|
||||||
static void updatesizehints(Client *c);
|
static void updatesizehints(Client *c);
|
||||||
static void updatestatus(void);
|
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 updatetitle(Client *c);
|
static void updatetitle(Client *c);
|
||||||
static void updatewindowtype(Client *c);
|
static void updatewindowtype(Client *c);
|
||||||
static void updatewmhints(Client *c);
|
static void updatewmhints(Client *c);
|
||||||
|
@ -266,32 +256,15 @@ static void view(const Arg *arg);
|
||||||
static void viewrel(const Arg *arg);
|
static void viewrel(const Arg *arg);
|
||||||
static Client *wintoclient(Window w);
|
static Client *wintoclient(Window w);
|
||||||
static Monitor *wintomon(Window w);
|
static Monitor *wintomon(Window w);
|
||||||
static Client *wintosystrayicon(Window w);
|
|
||||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
static int xerror(Display *dpy, XErrorEvent *ee);
|
||||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||||
static void zoom(const Arg *arg);
|
static void zoom(const Arg *arg);
|
||||||
|
|
||||||
static pid_t getparentprocess(pid_t p);
|
#include "dwm/handlers.h"
|
||||||
static int isdescprocess(pid_t p, pid_t c);
|
#include "dwm/layouts.h"
|
||||||
static Client *swallowingclient(Window w);
|
#include "dwm/swallow.h"
|
||||||
static Client *termforwin(const Client *c);
|
#include "dwm/systray.h"
|
||||||
static pid_t winpid(Window w);
|
|
||||||
|
|
||||||
/* handlers */
|
|
||||||
static void on_button_press(XEvent *e);
|
|
||||||
static void on_client_message(XEvent *e);
|
|
||||||
static void on_configure_notify(XEvent *e);
|
|
||||||
static void on_configure_request(XEvent *e);
|
|
||||||
static void on_destroy_notify(XEvent *e);
|
|
||||||
static void on_expose(XEvent *e);
|
|
||||||
static void on_focus_in(XEvent *e);
|
|
||||||
static void on_key_press(XEvent *e);
|
|
||||||
static void on_mapping_notify(XEvent *e);
|
|
||||||
static void on_map_request(XEvent *e);
|
|
||||||
static void on_property_notify(XEvent *e);
|
|
||||||
static void on_resize_request(XEvent *e);
|
|
||||||
static void on_unmap_notify(XEvent *e);
|
|
||||||
|
|
||||||
/* variables */
|
/* variables */
|
||||||
static Systray *systray = NULL;
|
static Systray *systray = NULL;
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#ifndef _DWM_HANDLERS_C
|
||||||
|
#define _DWM_HANDLERS_C
|
||||||
|
|
||||||
void
|
void
|
||||||
on_button_press(XEvent *e)
|
on_button_press(XEvent *e)
|
||||||
{
|
{
|
||||||
|
@ -367,3 +370,5 @@ on_unmap_notify(XEvent *e)
|
||||||
updatesystray();
|
updatesystray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // _DWM_HANDLERS_C
|
||||||
|
|
18
dwm/handlers.h
Normal file
18
dwm/handlers.h
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#ifndef _DWM_HANDLERS_H
|
||||||
|
#define _DWM_HANDLERS_H
|
||||||
|
|
||||||
|
static void on_button_press(XEvent *e);
|
||||||
|
static void on_client_message(XEvent *e);
|
||||||
|
static void on_configure_notify(XEvent *e);
|
||||||
|
static void on_configure_request(XEvent *e);
|
||||||
|
static void on_destroy_notify(XEvent *e);
|
||||||
|
static void on_expose(XEvent *e);
|
||||||
|
static void on_focus_in(XEvent *e);
|
||||||
|
static void on_key_press(XEvent *e);
|
||||||
|
static void on_mapping_notify(XEvent *e);
|
||||||
|
static void on_map_request(XEvent *e);
|
||||||
|
static void on_property_notify(XEvent *e);
|
||||||
|
static void on_resize_request(XEvent *e);
|
||||||
|
static void on_unmap_notify(XEvent *e);
|
||||||
|
|
||||||
|
#endif // _DWM_HANDLERS_H
|
|
@ -1,3 +1,6 @@
|
||||||
|
#ifndef _DWM_LAYOUTS_C
|
||||||
|
#define _DWM_LAYOUTS_C
|
||||||
|
|
||||||
void
|
void
|
||||||
centeredmaster(Monitor *m)
|
centeredmaster(Monitor *m)
|
||||||
{
|
{
|
||||||
|
@ -259,3 +262,5 @@ tile(Monitor *m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // _DWM_LAYOUTS_C
|
||||||
|
|
9
dwm/layouts.h
Normal file
9
dwm/layouts.h
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#ifndef _DWM_LAYOUTS_H
|
||||||
|
#define _DWM_LAYOUTS_H
|
||||||
|
|
||||||
|
static void centeredmaster(Monitor *m);
|
||||||
|
static void horizontile(Monitor *);
|
||||||
|
static void monocle(Monitor *m);
|
||||||
|
static void tile(Monitor *);
|
||||||
|
|
||||||
|
#endif // _DWM_LAYOUTS_H
|
|
@ -1,3 +1,6 @@
|
||||||
|
#ifndef _DWM_SWALLOW_C
|
||||||
|
#define _DWM_SWALLOW_C
|
||||||
|
|
||||||
pid_t
|
pid_t
|
||||||
getparentprocess(pid_t p)
|
getparentprocess(pid_t p)
|
||||||
{
|
{
|
||||||
|
@ -172,3 +175,5 @@ winpid(Window w)
|
||||||
#endif /* __OpenBSD__ */
|
#endif /* __OpenBSD__ */
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // _DWM_SWALLOW_C
|
||||||
|
|
12
dwm/swallow.h
Normal file
12
dwm/swallow.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef _DWM_SWALLOW_H
|
||||||
|
#define _DWM_SWALLOW_H
|
||||||
|
|
||||||
|
static pid_t getparentprocess(pid_t p);
|
||||||
|
static int isdescprocess(pid_t p, pid_t c);
|
||||||
|
static void swallow(Client *p, Client *c);
|
||||||
|
static Client *swallowingclient(Window w);
|
||||||
|
static Client *termforwin(const Client *c);
|
||||||
|
static void unswallow(Client *c);
|
||||||
|
static pid_t winpid(Window w);
|
||||||
|
|
||||||
|
#endif // _DWM_SWALLOW_H
|
|
@ -1,3 +1,6 @@
|
||||||
|
#ifndef _DWM_SYSTRAY_C
|
||||||
|
#define _DWM_SYSTRAY_C
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
getsystraywidth()
|
getsystraywidth()
|
||||||
{
|
{
|
||||||
|
@ -163,3 +166,5 @@ wintosystrayicon(Window w) {
|
||||||
for (i = systray->icons; i && i->win != w; i = i->next) ;
|
for (i = systray->icons; i && i->win != w; i = i->next) ;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // _DWM_SYSTRAY_C
|
||||||
|
|
12
dwm/systray.h
Normal file
12
dwm/systray.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef _DWM_SYSTRAY_H
|
||||||
|
#define _DWM_SYSTRAY_H
|
||||||
|
|
||||||
|
static unsigned int getsystraywidth();
|
||||||
|
static void removesystrayicon(Client *i);
|
||||||
|
static Monitor *systraytomon(Monitor *m);
|
||||||
|
static void updatesystray(void);
|
||||||
|
static void updatesystrayicongeom(Client *i, int w, int h);
|
||||||
|
static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
|
||||||
|
static Client *wintosystrayicon(Window w);
|
||||||
|
|
||||||
|
#endif // _DWM_SYSTRAY_H
|
Loading…
Reference in a new issue