mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
hit it with the knf stick.
This commit is contained in:
parent
3a94c57afc
commit
75182c6d9c
2
calmwm.c
2
calmwm.c
@ -302,7 +302,7 @@ _sigchld_cb(int which)
|
||||
pid_t pid;
|
||||
int status;
|
||||
|
||||
/* Collect dead children. */
|
||||
/* Collect dead children. */
|
||||
while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
|
||||
(pid < 0 && errno == EINTR))
|
||||
;
|
||||
|
57
calmwm.h
57
calmwm.h
@ -44,8 +44,6 @@ struct client_ctx;
|
||||
|
||||
TAILQ_HEAD(cycle_entry_q, client_ctx);
|
||||
|
||||
/* #define CYCLE_FOREACH_MRU(cy, ctx) TAILQ_FOREACH((ctx), */
|
||||
|
||||
struct screen_ctx;
|
||||
|
||||
struct fontdesc {
|
||||
@ -211,7 +209,7 @@ TAILQ_HEAD(xevent_q, xevent);
|
||||
|
||||
#define CWM_BIGMOVE 0x1000
|
||||
enum directions {
|
||||
CWM_UP=0, CWM_DOWN, CWM_LEFT, CWM_RIGHT,
|
||||
CWM_UP = 0, CWM_DOWN, CWM_LEFT, CWM_RIGHT,
|
||||
};
|
||||
|
||||
/*
|
||||
@ -249,7 +247,6 @@ struct keybinding {
|
||||
struct cmd {
|
||||
TAILQ_ENTRY(cmd) entry;
|
||||
int flags;
|
||||
#define CMD_STATIC 0x01 /* static configuration in conf.c */
|
||||
char image[MAXPATHLEN];
|
||||
char label[256];
|
||||
/* (argv) */
|
||||
@ -266,8 +263,8 @@ struct conf {
|
||||
char conf_path[MAXPATHLEN];
|
||||
struct cmd_q cmdq;
|
||||
|
||||
int flags;
|
||||
#define CONF_STICKY_GROUPS 0x0001
|
||||
int flags;
|
||||
|
||||
char termpath[MAXPATHLEN];
|
||||
char lockpath[MAXPATHLEN];
|
||||
@ -314,7 +311,8 @@ struct mwm_hints {
|
||||
#define MWM_DECOR_ALL (1 << 0)
|
||||
#define MWM_DECOR_BORDER (1 << 1)
|
||||
|
||||
int input_keycodetrans(KeyCode, u_int, enum ctltype *, char *, int);
|
||||
int input_keycodetrans(KeyCode, u_int, enum ctltype *,
|
||||
char *, int);
|
||||
|
||||
int x_errorhandler(Display *, XErrorEvent *);
|
||||
void x_setup(char *display_name);
|
||||
@ -377,10 +375,12 @@ void xev_handle_clientmessage(struct xevent *, XEvent *);
|
||||
xev_register(xev_new(a, b, c, d, e)); \
|
||||
} while (0)
|
||||
|
||||
void xev_reconfig(struct client_ctx *); /* XXX should be xu_ */
|
||||
/* XXX should be xu_ */
|
||||
void xev_reconfig(struct client_ctx *);
|
||||
|
||||
void xev_init(void);
|
||||
struct xevent *xev_new(Window *, Window *, int, void (*)(struct xevent *, XEvent *), void *);
|
||||
struct xevent *xev_new(Window *, Window *, int,
|
||||
void (*)(struct xevent *, XEvent *), void *);
|
||||
void xev_register(struct xevent *);
|
||||
void xev_loop(void);
|
||||
|
||||
@ -393,7 +393,8 @@ void xu_ptr_setpos(Window, int, int);
|
||||
void xu_ptr_getpos(Window, int *, int *);
|
||||
void xu_key_grab(Window, int, int);
|
||||
void xu_sendmsg(struct client_ctx *, Atom, long);
|
||||
int xu_getprop(struct client_ctx *, Atom, Atom, long, u_char **);
|
||||
int xu_getprop(struct client_ctx *, Atom, Atom, long,
|
||||
u_char **);
|
||||
char *xu_getstrprop(struct client_ctx *, Atom atm);
|
||||
void xu_setstate(struct client_ctx *, int);
|
||||
int xu_getstate(struct client_ctx *, int *);
|
||||
@ -428,12 +429,13 @@ void screen_infomsg(char *);
|
||||
void conf_setup(struct conf *, const char *);
|
||||
int conf_get_int(struct client_ctx *, enum conftype);
|
||||
void conf_client(struct client_ctx *);
|
||||
void conf_bindkey(struct conf *, void (*)(struct client_ctx *, void *),
|
||||
void conf_bindkey(struct conf *,
|
||||
void (*)(struct client_ctx *, void *),
|
||||
int, int, int, void *);
|
||||
void conf_bindname(struct conf *, char *, char *);
|
||||
void conf_unbind(struct conf *, struct keybinding *);
|
||||
int conf_changed(char *);
|
||||
void conf_reload(struct conf *c);
|
||||
void conf_reload(struct conf *);
|
||||
char *conf_get_str(struct client_ctx *, enum conftype);
|
||||
|
||||
void kbfunc_client_lower(struct client_ctx *, void *);
|
||||
@ -441,7 +443,7 @@ void kbfunc_client_raise(struct client_ctx *, void *);
|
||||
void kbfunc_client_search(struct client_ctx *, void *);
|
||||
void kbfunc_client_hide(struct client_ctx *, void *);
|
||||
void kbfunc_client_cycle(struct client_ctx *, void *);
|
||||
void kbfunc_client_rcycle(struct client_ctx *cc, void *arg);
|
||||
void kbfunc_client_rcycle(struct client_ctx *, void *);
|
||||
void kbfunc_cmdexec(struct client_ctx *, void *);
|
||||
void kbfunc_client_label(struct client_ctx *, void *);
|
||||
void kbfunc_client_delete(struct client_ctx *, void *);
|
||||
@ -458,18 +460,21 @@ void kbfunc_menu_search(struct client_ctx *, void *);
|
||||
void kbfunc_exec(struct client_ctx *, void *);
|
||||
void kbfunc_ptrmove(struct client_ctx *, void *);
|
||||
void kbfunc_ssh(struct client_ctx *, void *);
|
||||
void kbfunc_term(struct client_ctx *cc, void *arg);
|
||||
void kbfunc_lock(struct client_ctx *cc, void *arg);
|
||||
void kbfunc_term(struct client_ctx *, void *);
|
||||
void kbfunc_lock(struct client_ctx *, void *);
|
||||
|
||||
void search_init(struct screen_ctx *);
|
||||
struct menu *search_start(struct menu_q *menuq,
|
||||
void (*match)(struct menu_q *, struct menu_q *, char *),
|
||||
void (*print)(struct menu *mi, int),
|
||||
char *, int);
|
||||
void search_match_client(struct menu_q *, struct menu_q *, char *);
|
||||
void search_match_client(struct menu_q *, struct menu_q *,
|
||||
char *);
|
||||
void search_print_client(struct menu *mi, int list);
|
||||
void search_match_text(struct menu_q *, struct menu_q *, char *);
|
||||
void search_match_exec(struct menu_q *, struct menu_q *, char *);
|
||||
void search_match_text(struct menu_q *, struct menu_q *,
|
||||
char *);
|
||||
void search_match_exec(struct menu_q *, struct menu_q *,
|
||||
char *);
|
||||
|
||||
void group_init(void);
|
||||
void group_hidetoggle(int);
|
||||
@ -482,16 +487,14 @@ void group_sticky_toggle_enter(struct client_ctx *);
|
||||
void group_sticky_toggle_exit(struct client_ctx *);
|
||||
void group_autogroup(struct client_ctx *);
|
||||
|
||||
void notification_init(struct screen_ctx *);
|
||||
|
||||
void font_init(struct screen_ctx *sc);
|
||||
struct fontdesc *font_get(struct screen_ctx *sc, const char *name);
|
||||
int font_width(struct fontdesc *fdp, const char *text, int len);
|
||||
void font_draw(struct fontdesc *fdp, const char *text, int len,
|
||||
Drawable d, int x, int y);
|
||||
int font_ascent(struct fontdesc *fdp);
|
||||
int font_descent(struct fontdesc *fdp);
|
||||
struct fontdesc *font_getx(struct screen_ctx *sc, const char *name);
|
||||
void font_init(struct screen_ctx *);
|
||||
struct fontdesc *font_get(struct screen_ctx *, const char *);
|
||||
int font_width(struct fontdesc *, const char *, int);
|
||||
void font_draw(struct fontdesc *, const char *, int,
|
||||
Drawable, int, int);
|
||||
int font_ascent(struct fontdesc *);
|
||||
int font_descent(struct fontdesc *);
|
||||
struct fontdesc *font_getx(struct screen_ctx *, const char *);
|
||||
|
||||
#define CCTOSC(cc) (cc->sc)
|
||||
|
||||
|
7
client.c
7
client.c
@ -67,7 +67,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
||||
cc->state = mapped ? NormalState : IconicState;
|
||||
cc->sc = sc;
|
||||
cc->win = win;
|
||||
cc->size= XAllocSizeHints();
|
||||
cc->size = XAllocSizeHints();
|
||||
if (cc->size->width_inc == 0)
|
||||
cc->size->width_inc = 1;
|
||||
if (cc->size->height_inc == 0)
|
||||
@ -154,7 +154,8 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
||||
|
||||
XShapeSelectInput(X_Dpy, cc->win, ShapeNotifyMask);
|
||||
|
||||
r = XShapeGetRectangles(X_Dpy, cc->win, ShapeBounding, &n, &tmp);
|
||||
r = XShapeGetRectangles(X_Dpy, cc->win, ShapeBounding,
|
||||
&n, &tmp);
|
||||
if (n > 1)
|
||||
XShapeCombineShape(X_Dpy, cc->pwin, ShapeBounding,
|
||||
0, 0, /* XXX border */
|
||||
@ -671,7 +672,7 @@ client__cycle(struct client_ctx *cc,
|
||||
break;
|
||||
} while (cc != save);
|
||||
|
||||
return cc != save ? cc : NULL;
|
||||
return (cc != save ? cc : NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
5
conf.c
5
conf.c
@ -166,8 +166,7 @@ conf_setup(struct conf *c, const char *conffile)
|
||||
|
||||
snprintf(c->conf_path, sizeof(c->conf_path), "%s/%s", home,
|
||||
CONFFILE);
|
||||
}
|
||||
else
|
||||
} else
|
||||
snprintf(c->conf_path, sizeof(c->conf_path), "%s", conffile);
|
||||
|
||||
conf_init(c);
|
||||
@ -335,7 +334,7 @@ conf_bindname(struct conf *c, char *name, char *binding)
|
||||
}
|
||||
|
||||
if (current_binding->keysym == NoSymbol &&
|
||||
current_binding->keycode == 0 ) {
|
||||
current_binding->keycode == 0) {
|
||||
xfree(current_binding);
|
||||
return;
|
||||
}
|
||||
|
1
cwmrc
1
cwmrc
@ -25,4 +25,3 @@
|
||||
#bind CM-r "label"
|
||||
#bind CS-Return "xterm -e top"
|
||||
#bind 4-o "unmap"
|
||||
|
||||
|
10
cwmrc.5
10
cwmrc.5
@ -15,7 +15,7 @@
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.\" The following requests are required for all man pages.
|
||||
.Dd $Mdocdate: March 23 2008 $
|
||||
.Dd $Mdocdate: April 15 2008 $
|
||||
.Dt CWMRC 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -90,8 +90,8 @@ will cause any instances of
|
||||
to not have borders.
|
||||
.It Ic bind Ar keys Ar command
|
||||
Cause the creation of keyboard shortcuts.
|
||||
The default shortcuts will always be created. In case of conflict,
|
||||
user-defined shortcuts take precidence.
|
||||
The default shortcuts will always be created.
|
||||
In case of conflict, user-defined shortcuts take precidence.
|
||||
The modifier keys come first, followed by a ``-''.
|
||||
The following modifiers are recognised:
|
||||
.Bl -tag -width Ds
|
||||
@ -117,8 +117,8 @@ structure in
|
||||
.Pa conf.c ,
|
||||
or, alternatively it should be the commandline that is wished to be executed.
|
||||
A special case is the ``unmap'' keyword, which causes any bindings using the
|
||||
named shortcut to be removed. This can be used to remove a binding which conflicts
|
||||
with an application.
|
||||
named shortcut to be removed.
|
||||
This can be used to remove a binding which conflicts with an application.
|
||||
.Pp
|
||||
For example, to cause
|
||||
.Ic C-M-r
|
||||
|
7
font.c
7
font.c
@ -27,7 +27,7 @@ HASH_GENERATE(fonthash, fontdesc, node, fontdesc_cmp);
|
||||
int
|
||||
fontdesc_cmp(struct fontdesc *a, struct fontdesc *b)
|
||||
{
|
||||
return strcmp(a->name, b->name);
|
||||
return (strcmp(a->name, b->name));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -130,13 +130,13 @@ font_draw(struct fontdesc *fdp, const char *text, int len,
|
||||
int
|
||||
font_ascent(struct fontdesc *fdp)
|
||||
{
|
||||
return fdp->fn->ascent;
|
||||
return (fdp->fn->ascent);
|
||||
}
|
||||
|
||||
int
|
||||
font_descent(struct fontdesc *fdp)
|
||||
{
|
||||
return fdp->fn->descent;
|
||||
return (fdp->fn->descent);
|
||||
}
|
||||
|
||||
static XftFont *
|
||||
@ -156,4 +156,3 @@ _make_font(struct screen_ctx *sc, struct fontdesc *fdp)
|
||||
|
||||
return (fn);
|
||||
}
|
||||
|
||||
|
5
grab.c
5
grab.c
@ -334,7 +334,8 @@ grab_label(struct client_ctx *cc)
|
||||
}
|
||||
|
||||
case Expose:
|
||||
snprintf(dispstr, sizeof(dispstr), "label>%s", labelstr);
|
||||
snprintf(dispstr, sizeof(dispstr), "label>%s",
|
||||
labelstr);
|
||||
dx = font_width(font, dispstr, strlen(dispstr));
|
||||
dy = fontheight;
|
||||
|
||||
@ -397,5 +398,5 @@ menu_calc_entry(int x, int y, int width, int height, int noentries)
|
||||
entry < 0 || entry >= noentries)
|
||||
entry = -1;
|
||||
|
||||
return entry;
|
||||
return (entry);
|
||||
}
|
||||
|
2
group.c
2
group.c
@ -315,7 +315,7 @@ group_alltoggle(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i < CALMWM_NGROUPS; i++) {
|
||||
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
||||
if (Grouphideall)
|
||||
_group_show(&Groups[i]);
|
||||
else
|
||||
|
2
hash.h
2
hash.h
@ -52,7 +52,7 @@ struct type *name##_HASH_TREE_FIND(struct name *head, struct type *find) \
|
||||
{ \
|
||||
struct name##_HASH_TREE *bucket = \
|
||||
&head->buckets[(*head->hashfn)(find) % HASH_NBUCKETS(head)]; \
|
||||
return SPLAY_FIND(name##_HASH_TREE, bucket, find); \
|
||||
return (SPLAY_FIND(name##_HASH_TREE, bucket, find)); \
|
||||
} \
|
||||
void name##_HASH_TREE_INSERT(struct name *head, struct type *insert) \
|
||||
{ \
|
||||
|
8
kbfunc.c
8
kbfunc.c
@ -57,7 +57,7 @@ kbfunc_client_move(struct client_ctx *cc, void *arg)
|
||||
amt = amt*10;
|
||||
}
|
||||
|
||||
switch(flags) {
|
||||
switch (flags) {
|
||||
case CWM_UP:
|
||||
my -= amt;
|
||||
break;
|
||||
@ -97,7 +97,7 @@ kbfunc_client_resize(struct client_ctx *cc, void *arg)
|
||||
amt = amt*10;
|
||||
}
|
||||
|
||||
switch(flags) {
|
||||
switch (flags) {
|
||||
case CWM_UP:
|
||||
my -= amt;
|
||||
break;
|
||||
@ -139,7 +139,7 @@ kbfunc_ptrmove(struct client_ctx *cc, void *arg)
|
||||
flags -= CWM_BIGMOVE;
|
||||
amt = amt * 10;
|
||||
}
|
||||
switch(flags) {
|
||||
switch (flags) {
|
||||
case CWM_UP:
|
||||
my -= amt;
|
||||
break;
|
||||
@ -278,7 +278,7 @@ kbfunc_exec(struct client_ctx *scratch, void *arg)
|
||||
char *label;
|
||||
|
||||
int cmd = (int)arg;
|
||||
switch(cmd) {
|
||||
switch (cmd) {
|
||||
case CWM_EXEC_PROGRAM:
|
||||
label = "exec";
|
||||
break;
|
||||
|
19
parse.y
19
parse.y
@ -40,6 +40,7 @@ static struct file {
|
||||
int lineno;
|
||||
int errors;
|
||||
} *file;
|
||||
|
||||
struct file *pushfile(const char *);
|
||||
int popfile(void);
|
||||
int yyparse(void);
|
||||
@ -548,36 +549,42 @@ parse_config(const char *filename, struct conf *xconf)
|
||||
|
||||
xconf->flags = conf->flags;
|
||||
|
||||
for (cmd = TAILQ_FIRST(&conf->cmdq); cmd != NULL; cmd = cmdnext) {
|
||||
for (cmd = TAILQ_FIRST(&conf->cmdq); cmd != NULL;
|
||||
cmd = cmdnext) {
|
||||
cmdnext = TAILQ_NEXT(cmd, entry);
|
||||
|
||||
TAILQ_REMOVE(&conf->cmdq, cmd, entry);
|
||||
TAILQ_INSERT_TAIL(&xconf->cmdq, cmd, entry);
|
||||
}
|
||||
|
||||
for (kb = TAILQ_FIRST(&conf->keybindingq); kb != NULL; kb = kbnext) {
|
||||
for (kb = TAILQ_FIRST(&conf->keybindingq); kb != NULL;
|
||||
kb = kbnext) {
|
||||
kbnext = TAILQ_NEXT(kb, entry);
|
||||
|
||||
TAILQ_REMOVE(&conf->keybindingq, kb, entry);
|
||||
TAILQ_INSERT_TAIL(&xconf->keybindingq, kb, entry);
|
||||
}
|
||||
|
||||
for (ag = TAILQ_FIRST(&conf->autogroupq); ag != NULL; ag = agnext) {
|
||||
for (ag = TAILQ_FIRST(&conf->autogroupq); ag != NULL;
|
||||
ag = agnext) {
|
||||
agnext = TAILQ_NEXT(ag, entry);
|
||||
|
||||
TAILQ_REMOVE(&conf->autogroupq, ag, entry);
|
||||
TAILQ_INSERT_TAIL(&xconf->autogroupq, ag, entry);
|
||||
}
|
||||
|
||||
for (wm = TAILQ_FIRST(&conf->ignoreq); wm != NULL; wm = wmnext) {
|
||||
for (wm = TAILQ_FIRST(&conf->ignoreq); wm != NULL;
|
||||
wm = wmnext) {
|
||||
wmnext = TAILQ_NEXT(wm, entry);
|
||||
|
||||
TAILQ_REMOVE(&conf->ignoreq, wm, entry);
|
||||
TAILQ_INSERT_TAIL(&xconf->ignoreq, wm, entry);
|
||||
}
|
||||
|
||||
strlcpy(xconf->termpath, conf->termpath, sizeof(xconf->termpath));
|
||||
strlcpy(xconf->lockpath, conf->lockpath, sizeof(xconf->lockpath));
|
||||
strlcpy(xconf->termpath, conf->termpath,
|
||||
sizeof(xconf->termpath));
|
||||
strlcpy(xconf->lockpath, conf->lockpath,
|
||||
sizeof(xconf->lockpath));
|
||||
|
||||
xconf->DefaultFontName = conf->DefaultFontName;
|
||||
|
||||
|
1
screen.c
1
screen.c
@ -76,7 +76,6 @@ screen_updatestackingorder(void)
|
||||
void
|
||||
screen_init(void)
|
||||
{
|
||||
|
||||
struct screen_ctx *sc = screen_current();
|
||||
|
||||
sc->cycle_client = NULL;
|
||||
|
22
util.c
22
util.c
@ -65,28 +65,30 @@ exec_wm(char *argstr)
|
||||
warn(args[0]);
|
||||
}
|
||||
|
||||
int dirent_isdir(char *filename) {
|
||||
int
|
||||
dirent_isdir(char *filename)
|
||||
{
|
||||
struct stat buffer;
|
||||
int return_value;
|
||||
|
||||
return_value = stat(filename, &buffer);
|
||||
|
||||
if(return_value == -1)
|
||||
return 0;
|
||||
if (return_value == -1)
|
||||
return (0);
|
||||
else
|
||||
return S_ISDIR(buffer.st_mode);
|
||||
return (S_ISDIR(buffer.st_mode));
|
||||
}
|
||||
|
||||
int dirent_islink(char *filename) {
|
||||
int
|
||||
dirent_islink(char *filename)
|
||||
{
|
||||
struct stat buffer;
|
||||
int return_value;
|
||||
|
||||
return_value = lstat(filename, &buffer);
|
||||
|
||||
if(return_value == -1)
|
||||
return 0;
|
||||
if (return_value == -1)
|
||||
return (0);
|
||||
else
|
||||
return S_ISLNK(buffer.st_mode);
|
||||
return (S_ISLNK(buffer.st_mode));
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,9 +50,8 @@ xev_handle_maprequest(struct xevent *xev, XEvent *ee)
|
||||
XGetWindowAttributes(X_Dpy, e->window, &xattr);
|
||||
cc = client_new(e->window, screen_fromroot(xattr.root), 1);
|
||||
sc = CCTOSC(cc);
|
||||
} else {
|
||||
} else
|
||||
cc->beepbeep = 1;
|
||||
}
|
||||
|
||||
#ifdef notyet /* XXX - possibly, we shouldn't map if
|
||||
* the window is withdrawn. */
|
||||
@ -164,7 +163,7 @@ xev_handle_propertynotify(struct xevent *xev, XEvent *ee)
|
||||
long tmp;
|
||||
|
||||
if ((cc = client_find(e->window)) != NULL) {
|
||||
switch(e->atom) {
|
||||
switch (e->atom) {
|
||||
case XA_WM_NORMAL_HINTS:
|
||||
XGetWMNormalHints(X_Dpy, cc->win, cc->size, &tmp);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user