mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
nuke the leading underscore notation for local static functions - there
are far better ways to know. "go for it" oga@
This commit is contained in:
parent
d2cfeb40b4
commit
2c29a1de65
6
calmwm.c
6
calmwm.c
@ -38,7 +38,7 @@ int HasXinerama, HasRandr, Randr_ev;
|
||||
int Starting;
|
||||
struct conf Conf;
|
||||
|
||||
static void _sigchld_cb(int);
|
||||
static void sigchld_cb(int);
|
||||
static void dpy_init(const char *);
|
||||
static void x_setup(void);
|
||||
static void x_setupscreen(struct screen_ctx *, u_int);
|
||||
@ -66,7 +66,7 @@ main(int argc, char **argv)
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (signal(SIGCHLD, _sigchld_cb) == SIG_ERR)
|
||||
if (signal(SIGCHLD, sigchld_cb) == SIG_ERR)
|
||||
err(1, "signal");
|
||||
|
||||
group_init();
|
||||
@ -230,7 +230,7 @@ x_errorhandler(Display *dpy, XErrorEvent *e)
|
||||
}
|
||||
|
||||
static void
|
||||
_sigchld_cb(int which)
|
||||
sigchld_cb(int which)
|
||||
{
|
||||
pid_t pid;
|
||||
int save_errno = errno;
|
||||
|
6
client.c
6
client.c
@ -21,7 +21,7 @@
|
||||
#include "headers.h"
|
||||
#include "calmwm.h"
|
||||
|
||||
static int _client_inbound(struct client_ctx *, int, int);
|
||||
static int client_inbound(struct client_ctx *, int, int);
|
||||
|
||||
static char emptystring[] = "";
|
||||
struct client_ctx *_curcc = NULL;
|
||||
@ -368,7 +368,7 @@ client_ptrsave(struct client_ctx *cc)
|
||||
int x, y;
|
||||
|
||||
xu_ptr_getpos(cc->win, &x, &y);
|
||||
if (_client_inbound(cc, x, y)) {
|
||||
if (client_inbound(cc, x, y)) {
|
||||
cc->ptr.x = x;
|
||||
cc->ptr.y = y;
|
||||
}
|
||||
@ -704,7 +704,7 @@ client_freehints(struct client_ctx *cc)
|
||||
}
|
||||
|
||||
static int
|
||||
_client_inbound(struct client_ctx *cc, int x, int y)
|
||||
client_inbound(struct client_ctx *cc, int x, int y)
|
||||
{
|
||||
return (x < cc->geom.width && x >= 0 &&
|
||||
y < cc->geom.height && y >= 0);
|
||||
|
58
group.c
58
group.c
@ -24,11 +24,11 @@
|
||||
|
||||
#define CALMWM_NGROUPS 9
|
||||
|
||||
static void _group_add(struct group_ctx *, struct client_ctx *);
|
||||
static void _group_remove(struct client_ctx *);
|
||||
static void _group_hide(struct group_ctx *);
|
||||
static void _group_show(struct group_ctx *);
|
||||
static void _group_fix_hidden_state(struct group_ctx *);
|
||||
static void group_add(struct group_ctx *, struct client_ctx *);
|
||||
static void group_remove(struct client_ctx *);
|
||||
static void group_hide(struct group_ctx *);
|
||||
static void group_show(struct group_ctx *);
|
||||
static void group_fix_hidden_state(struct group_ctx *);
|
||||
|
||||
struct group_ctx *Group_active = NULL;
|
||||
struct group_ctx Groups[CALMWM_NGROUPS];
|
||||
@ -41,10 +41,10 @@ const char *shortcut_to_name[] = {
|
||||
};
|
||||
|
||||
static void
|
||||
_group_add(struct group_ctx *gc, struct client_ctx *cc)
|
||||
group_add(struct group_ctx *gc, struct client_ctx *cc)
|
||||
{
|
||||
if (cc == NULL || gc == NULL)
|
||||
errx(1, "_group_add: a ctx is NULL");
|
||||
errx(1, "group_add: a ctx is NULL");
|
||||
|
||||
if (cc->group == gc)
|
||||
return;
|
||||
@ -60,10 +60,10 @@ _group_add(struct group_ctx *gc, struct client_ctx *cc)
|
||||
}
|
||||
|
||||
static void
|
||||
_group_remove(struct client_ctx *cc)
|
||||
group_remove(struct client_ctx *cc)
|
||||
{
|
||||
if (cc == NULL || cc->group == NULL)
|
||||
errx(1, "_group_remove: a ctx is NULL");
|
||||
errx(1, "group_remove: a ctx is NULL");
|
||||
|
||||
XChangeProperty(X_Dpy, cc->win, _CWM_GRP, XA_STRING, 8,
|
||||
PropModeReplace, shortcut_to_name[0],
|
||||
@ -74,7 +74,7 @@ _group_remove(struct client_ctx *cc)
|
||||
}
|
||||
|
||||
static void
|
||||
_group_hide(struct group_ctx *gc)
|
||||
group_hide(struct group_ctx *gc)
|
||||
{
|
||||
struct client_ctx *cc;
|
||||
|
||||
@ -92,7 +92,7 @@ _group_hide(struct group_ctx *gc)
|
||||
}
|
||||
|
||||
static void
|
||||
_group_show(struct group_ctx *gc)
|
||||
group_show(struct group_ctx *gc)
|
||||
{
|
||||
struct client_ctx *cc;
|
||||
Window *winlist;
|
||||
@ -153,7 +153,7 @@ group_movetogroup(struct client_ctx *cc, int idx)
|
||||
err(1, "group_movetogroup: index out of range (%d)", idx);
|
||||
|
||||
client_hide(cc);
|
||||
_group_add(&Groups[idx], cc);
|
||||
group_add(&Groups[idx], cc);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -167,10 +167,10 @@ group_sticky_toggle_enter(struct client_ctx *cc)
|
||||
gc = Group_active;
|
||||
|
||||
if (gc == cc->group) {
|
||||
_group_remove(cc);
|
||||
group_remove(cc);
|
||||
cc->highlight = CLIENT_HIGHLIGHT_UNGROUP;
|
||||
} else {
|
||||
_group_add(gc, cc);
|
||||
group_add(gc, cc);
|
||||
cc->highlight = CLIENT_HIGHLIGHT_GROUP;
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ group_sticky_toggle_exit(struct client_ctx *cc)
|
||||
* if group_hidetoggle would produce no effect, toggle the group's hidden state
|
||||
*/
|
||||
static void
|
||||
_group_fix_hidden_state(struct group_ctx *gc)
|
||||
group_fix_hidden_state(struct group_ctx *gc)
|
||||
{
|
||||
struct client_ctx *cc;
|
||||
int same = 0;
|
||||
@ -212,12 +212,12 @@ group_hidetoggle(int idx)
|
||||
|
||||
gc = &Groups[idx];
|
||||
|
||||
_group_fix_hidden_state(gc);
|
||||
group_fix_hidden_state(gc);
|
||||
|
||||
if (gc->hidden)
|
||||
_group_show(gc);
|
||||
group_show(gc);
|
||||
else {
|
||||
_group_hide(gc);
|
||||
group_hide(gc);
|
||||
if (TAILQ_EMPTY(&gc->clients))
|
||||
Group_active = gc;
|
||||
}
|
||||
@ -233,9 +233,9 @@ group_only(int idx)
|
||||
|
||||
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
||||
if (i == idx)
|
||||
_group_show(&Groups[i]);
|
||||
group_show(&Groups[i]);
|
||||
else
|
||||
_group_hide(&Groups[i]);
|
||||
group_hide(&Groups[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,16 +262,16 @@ group_cycle(int reverse)
|
||||
if (!TAILQ_EMPTY(&gc->clients) && showgroup == NULL)
|
||||
showgroup = gc;
|
||||
else if (!gc->hidden)
|
||||
_group_hide(gc);
|
||||
group_hide(gc);
|
||||
}
|
||||
|
||||
if (showgroup == NULL)
|
||||
return;
|
||||
|
||||
_group_hide(Group_active);
|
||||
group_hide(Group_active);
|
||||
|
||||
if (showgroup->hidden)
|
||||
_group_show(showgroup);
|
||||
group_show(showgroup);
|
||||
else
|
||||
Group_active = showgroup;
|
||||
}
|
||||
@ -325,9 +325,9 @@ group_menu(XButtonEvent *e)
|
||||
gc = (struct group_ctx *)mi->ctx;
|
||||
|
||||
if (gc->hidden)
|
||||
_group_show(gc);
|
||||
group_show(gc);
|
||||
else
|
||||
_group_hide(gc);
|
||||
group_hide(gc);
|
||||
|
||||
cleanup:
|
||||
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
||||
@ -343,9 +343,9 @@ group_alltoggle(void)
|
||||
|
||||
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
||||
if (Grouphideall)
|
||||
_group_show(&Groups[i]);
|
||||
group_show(&Groups[i]);
|
||||
else
|
||||
_group_hide(&Groups[i]);
|
||||
group_hide(&Groups[i]);
|
||||
}
|
||||
|
||||
if (Grouphideall)
|
||||
@ -384,12 +384,12 @@ group_autogroup(struct client_ctx *cc)
|
||||
|
||||
TAILQ_FOREACH(gc, &Groupq, entry) {
|
||||
if (strcmp(shortcut_to_name[gc->shortcut], group) == 0) {
|
||||
_group_add(gc, cc);
|
||||
group_add(gc, cc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Conf.flags & CONF_STICKY_GROUPS)
|
||||
_group_add(Group_active, cc);
|
||||
group_add(Group_active, cc);
|
||||
|
||||
}
|
||||
|
14
mousefunc.c
14
mousefunc.c
@ -22,14 +22,14 @@
|
||||
#include "headers.h"
|
||||
#include "calmwm.h"
|
||||
|
||||
static int _mousefunc_sweep_calc(struct client_ctx *, int, int, int, int);
|
||||
static void _mousefunc_sweep_draw(struct client_ctx *, int, int);
|
||||
static int mousefunc_sweep_calc(struct client_ctx *, int, int, int, int);
|
||||
static void mousefunc_sweep_draw(struct client_ctx *, int, int);
|
||||
|
||||
#define ADJUST_HEIGHT(cc, dy) ((cc->geom.height - cc->geom.min_dy) / dy)
|
||||
#define ADJUST_WIDTH(cc, dx) ((cc->geom.width - cc->geom.min_dx) / dx)
|
||||
|
||||
static int
|
||||
_mousefunc_sweep_calc(struct client_ctx *cc, int x, int y, int mx, int my)
|
||||
mousefunc_sweep_calc(struct client_ctx *cc, int x, int y, int mx, int my)
|
||||
{
|
||||
int width = cc->geom.width, height = cc->geom.height;
|
||||
|
||||
@ -60,7 +60,7 @@ _mousefunc_sweep_calc(struct client_ctx *cc, int x, int y, int mx, int my)
|
||||
}
|
||||
|
||||
static void
|
||||
_mousefunc_sweep_draw(struct client_ctx *cc, int dx, int dy)
|
||||
mousefunc_sweep_draw(struct client_ctx *cc, int dx, int dy)
|
||||
{
|
||||
struct screen_ctx *sc = CCTOSC(cc);
|
||||
char asize[10]; /* fits "nnnnxnnnn\0" */
|
||||
@ -103,7 +103,7 @@ mousefunc_window_resize(struct client_ctx *cc, void *arg)
|
||||
return;
|
||||
|
||||
xu_ptr_setpos(cc->win, cc->geom.width, cc->geom.height);
|
||||
_mousefunc_sweep_draw(cc, dx, dy);
|
||||
mousefunc_sweep_draw(cc, dx, dy);
|
||||
|
||||
for (;;) {
|
||||
XMaskEvent(X_Dpy, MouseMask|ExposureMask, &ev);
|
||||
@ -113,10 +113,10 @@ mousefunc_window_resize(struct client_ctx *cc, void *arg)
|
||||
client_draw_border(cc);
|
||||
break;
|
||||
case MotionNotify:
|
||||
if (_mousefunc_sweep_calc(cc, x, y,
|
||||
if (mousefunc_sweep_calc(cc, x, y,
|
||||
ev.xmotion.x, ev.xmotion.y))
|
||||
/* Recompute window output */
|
||||
_mousefunc_sweep_draw(cc, dx, dy);
|
||||
mousefunc_sweep_draw(cc, dx, dy);
|
||||
|
||||
/* don't sync more than 60 times / second */
|
||||
if ((ev.xmotion.time - time) > (1000 / 60) ) {
|
||||
|
14
search.c
14
search.c
@ -22,7 +22,7 @@
|
||||
|
||||
#define SearchMask (KeyPressMask|ExposureMask)
|
||||
|
||||
static int _strsubmatch(char *, char *, int);
|
||||
static int strsubmatch(char *, char *, int);
|
||||
|
||||
/*
|
||||
* Match: label, title, class.
|
||||
@ -54,7 +54,7 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||
struct client_ctx *cc = mi->ctx;
|
||||
|
||||
/* First, try to match on labels. */
|
||||
if (cc->label != NULL && _strsubmatch(search, cc->label, 0)) {
|
||||
if (cc->label != NULL && strsubmatch(search, cc->label, 0)) {
|
||||
cc->matchname = cc->label;
|
||||
tier = 0;
|
||||
}
|
||||
@ -62,7 +62,7 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||
/* Then, on window names. */
|
||||
if (tier < 0) {
|
||||
TAILQ_FOREACH_REVERSE(wn, &cc->nameq, winname_q, entry)
|
||||
if (_strsubmatch(search, wn->name, 0)) {
|
||||
if (strsubmatch(search, wn->name, 0)) {
|
||||
cc->matchname = wn->name;
|
||||
tier = 2;
|
||||
break;
|
||||
@ -74,7 +74,7 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||
* name.
|
||||
*/
|
||||
|
||||
if (tier < 0 && _strsubmatch(search, cc->app_class, 0)) {
|
||||
if (tier < 0 && strsubmatch(search, cc->app_class, 0)) {
|
||||
cc->matchname = cc->app_class;
|
||||
tier = 3;
|
||||
}
|
||||
@ -168,7 +168,7 @@ search_match_text(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||
TAILQ_INIT(resultq);
|
||||
|
||||
TAILQ_FOREACH(mi, menuq, entry)
|
||||
if (_strsubmatch(search, mi->text, 0))
|
||||
if (strsubmatch(search, mi->text, 0))
|
||||
TAILQ_INSERT_TAIL(resultq, mi, resultentry);
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||
TAILQ_INIT(resultq);
|
||||
|
||||
TAILQ_FOREACH(mi, menuq, entry) {
|
||||
if (_strsubmatch(search, mi->text, 1) == 0)
|
||||
if (strsubmatch(search, mi->text, 1) == 0)
|
||||
continue;
|
||||
for (mj = TAILQ_FIRST(resultq); mj != NULL;
|
||||
mj = TAILQ_NEXT(mj, resultentry)) {
|
||||
@ -195,7 +195,7 @@ search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||
}
|
||||
|
||||
static int
|
||||
_strsubmatch(char *sub, char *str, int zeroidx)
|
||||
strsubmatch(char *sub, char *str, int zeroidx)
|
||||
{
|
||||
size_t len, sublen;
|
||||
u_int n, flen;
|
||||
|
Loading…
Reference in New Issue
Block a user