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:
okan 2009-05-18 00:23:35 +00:00
parent d2cfeb40b4
commit 2c29a1de65
5 changed files with 49 additions and 49 deletions

View File

@ -38,7 +38,7 @@ int HasXinerama, HasRandr, Randr_ev;
int Starting; int Starting;
struct conf Conf; struct conf Conf;
static void _sigchld_cb(int); static void sigchld_cb(int);
static void dpy_init(const char *); static void dpy_init(const char *);
static void x_setup(void); static void x_setup(void);
static void x_setupscreen(struct screen_ctx *, u_int); static void x_setupscreen(struct screen_ctx *, u_int);
@ -66,7 +66,7 @@ main(int argc, char **argv)
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if (signal(SIGCHLD, _sigchld_cb) == SIG_ERR) if (signal(SIGCHLD, sigchld_cb) == SIG_ERR)
err(1, "signal"); err(1, "signal");
group_init(); group_init();
@ -230,7 +230,7 @@ x_errorhandler(Display *dpy, XErrorEvent *e)
} }
static void static void
_sigchld_cb(int which) sigchld_cb(int which)
{ {
pid_t pid; pid_t pid;
int save_errno = errno; int save_errno = errno;

View File

@ -21,7 +21,7 @@
#include "headers.h" #include "headers.h"
#include "calmwm.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[] = ""; static char emptystring[] = "";
struct client_ctx *_curcc = NULL; struct client_ctx *_curcc = NULL;
@ -368,7 +368,7 @@ client_ptrsave(struct client_ctx *cc)
int x, y; int x, y;
xu_ptr_getpos(cc->win, &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.x = x;
cc->ptr.y = y; cc->ptr.y = y;
} }
@ -704,7 +704,7 @@ client_freehints(struct client_ctx *cc)
} }
static int 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 && return (x < cc->geom.width && x >= 0 &&
y < cc->geom.height && y >= 0); y < cc->geom.height && y >= 0);

58
group.c
View File

@ -24,11 +24,11 @@
#define CALMWM_NGROUPS 9 #define CALMWM_NGROUPS 9
static void _group_add(struct group_ctx *, struct client_ctx *); static void group_add(struct group_ctx *, struct client_ctx *);
static void _group_remove(struct client_ctx *); static void group_remove(struct client_ctx *);
static void _group_hide(struct group_ctx *); static void group_hide(struct group_ctx *);
static void _group_show(struct group_ctx *); static void group_show(struct group_ctx *);
static void _group_fix_hidden_state(struct group_ctx *); static void group_fix_hidden_state(struct group_ctx *);
struct group_ctx *Group_active = NULL; struct group_ctx *Group_active = NULL;
struct group_ctx Groups[CALMWM_NGROUPS]; struct group_ctx Groups[CALMWM_NGROUPS];
@ -41,10 +41,10 @@ const char *shortcut_to_name[] = {
}; };
static void 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) 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) if (cc->group == gc)
return; return;
@ -60,10 +60,10 @@ _group_add(struct group_ctx *gc, struct client_ctx *cc)
} }
static void static void
_group_remove(struct client_ctx *cc) group_remove(struct client_ctx *cc)
{ {
if (cc == NULL || cc->group == NULL) 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, XChangeProperty(X_Dpy, cc->win, _CWM_GRP, XA_STRING, 8,
PropModeReplace, shortcut_to_name[0], PropModeReplace, shortcut_to_name[0],
@ -74,7 +74,7 @@ _group_remove(struct client_ctx *cc)
} }
static void static void
_group_hide(struct group_ctx *gc) group_hide(struct group_ctx *gc)
{ {
struct client_ctx *cc; struct client_ctx *cc;
@ -92,7 +92,7 @@ _group_hide(struct group_ctx *gc)
} }
static void static void
_group_show(struct group_ctx *gc) group_show(struct group_ctx *gc)
{ {
struct client_ctx *cc; struct client_ctx *cc;
Window *winlist; Window *winlist;
@ -153,7 +153,7 @@ group_movetogroup(struct client_ctx *cc, int idx)
err(1, "group_movetogroup: index out of range (%d)", idx); err(1, "group_movetogroup: index out of range (%d)", idx);
client_hide(cc); 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; gc = Group_active;
if (gc == cc->group) { if (gc == cc->group) {
_group_remove(cc); group_remove(cc);
cc->highlight = CLIENT_HIGHLIGHT_UNGROUP; cc->highlight = CLIENT_HIGHLIGHT_UNGROUP;
} else { } else {
_group_add(gc, cc); group_add(gc, cc);
cc->highlight = CLIENT_HIGHLIGHT_GROUP; 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 * if group_hidetoggle would produce no effect, toggle the group's hidden state
*/ */
static void static void
_group_fix_hidden_state(struct group_ctx *gc) group_fix_hidden_state(struct group_ctx *gc)
{ {
struct client_ctx *cc; struct client_ctx *cc;
int same = 0; int same = 0;
@ -212,12 +212,12 @@ group_hidetoggle(int idx)
gc = &Groups[idx]; gc = &Groups[idx];
_group_fix_hidden_state(gc); group_fix_hidden_state(gc);
if (gc->hidden) if (gc->hidden)
_group_show(gc); group_show(gc);
else { else {
_group_hide(gc); group_hide(gc);
if (TAILQ_EMPTY(&gc->clients)) if (TAILQ_EMPTY(&gc->clients))
Group_active = gc; Group_active = gc;
} }
@ -233,9 +233,9 @@ group_only(int idx)
for (i = 0; i < CALMWM_NGROUPS; i++) { for (i = 0; i < CALMWM_NGROUPS; i++) {
if (i == idx) if (i == idx)
_group_show(&Groups[i]); group_show(&Groups[i]);
else else
_group_hide(&Groups[i]); group_hide(&Groups[i]);
} }
} }
@ -262,16 +262,16 @@ group_cycle(int reverse)
if (!TAILQ_EMPTY(&gc->clients) && showgroup == NULL) if (!TAILQ_EMPTY(&gc->clients) && showgroup == NULL)
showgroup = gc; showgroup = gc;
else if (!gc->hidden) else if (!gc->hidden)
_group_hide(gc); group_hide(gc);
} }
if (showgroup == NULL) if (showgroup == NULL)
return; return;
_group_hide(Group_active); group_hide(Group_active);
if (showgroup->hidden) if (showgroup->hidden)
_group_show(showgroup); group_show(showgroup);
else else
Group_active = showgroup; Group_active = showgroup;
} }
@ -325,9 +325,9 @@ group_menu(XButtonEvent *e)
gc = (struct group_ctx *)mi->ctx; gc = (struct group_ctx *)mi->ctx;
if (gc->hidden) if (gc->hidden)
_group_show(gc); group_show(gc);
else else
_group_hide(gc); group_hide(gc);
cleanup: cleanup:
while ((mi = TAILQ_FIRST(&menuq)) != NULL) { while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
@ -343,9 +343,9 @@ group_alltoggle(void)
for (i = 0; i < CALMWM_NGROUPS; i++) { for (i = 0; i < CALMWM_NGROUPS; i++) {
if (Grouphideall) if (Grouphideall)
_group_show(&Groups[i]); group_show(&Groups[i]);
else else
_group_hide(&Groups[i]); group_hide(&Groups[i]);
} }
if (Grouphideall) if (Grouphideall)
@ -384,12 +384,12 @@ group_autogroup(struct client_ctx *cc)
TAILQ_FOREACH(gc, &Groupq, entry) { TAILQ_FOREACH(gc, &Groupq, entry) {
if (strcmp(shortcut_to_name[gc->shortcut], group) == 0) { if (strcmp(shortcut_to_name[gc->shortcut], group) == 0) {
_group_add(gc, cc); group_add(gc, cc);
return; return;
} }
} }
if (Conf.flags & CONF_STICKY_GROUPS) if (Conf.flags & CONF_STICKY_GROUPS)
_group_add(Group_active, cc); group_add(Group_active, cc);
} }

View File

@ -22,14 +22,14 @@
#include "headers.h" #include "headers.h"
#include "calmwm.h" #include "calmwm.h"
static int _mousefunc_sweep_calc(struct client_ctx *, int, int, int, int); static int mousefunc_sweep_calc(struct client_ctx *, int, int, int, int);
static void _mousefunc_sweep_draw(struct client_ctx *, 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_HEIGHT(cc, dy) ((cc->geom.height - cc->geom.min_dy) / dy)
#define ADJUST_WIDTH(cc, dx) ((cc->geom.width - cc->geom.min_dx) / dx) #define ADJUST_WIDTH(cc, dx) ((cc->geom.width - cc->geom.min_dx) / dx)
static int 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; 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 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); struct screen_ctx *sc = CCTOSC(cc);
char asize[10]; /* fits "nnnnxnnnn\0" */ char asize[10]; /* fits "nnnnxnnnn\0" */
@ -103,7 +103,7 @@ mousefunc_window_resize(struct client_ctx *cc, void *arg)
return; return;
xu_ptr_setpos(cc->win, cc->geom.width, cc->geom.height); xu_ptr_setpos(cc->win, cc->geom.width, cc->geom.height);
_mousefunc_sweep_draw(cc, dx, dy); mousefunc_sweep_draw(cc, dx, dy);
for (;;) { for (;;) {
XMaskEvent(X_Dpy, MouseMask|ExposureMask, &ev); XMaskEvent(X_Dpy, MouseMask|ExposureMask, &ev);
@ -113,10 +113,10 @@ mousefunc_window_resize(struct client_ctx *cc, void *arg)
client_draw_border(cc); client_draw_border(cc);
break; break;
case MotionNotify: case MotionNotify:
if (_mousefunc_sweep_calc(cc, x, y, if (mousefunc_sweep_calc(cc, x, y,
ev.xmotion.x, ev.xmotion.y)) ev.xmotion.x, ev.xmotion.y))
/* Recompute window output */ /* Recompute window output */
_mousefunc_sweep_draw(cc, dx, dy); mousefunc_sweep_draw(cc, dx, dy);
/* don't sync more than 60 times / second */ /* don't sync more than 60 times / second */
if ((ev.xmotion.time - time) > (1000 / 60) ) { if ((ev.xmotion.time - time) > (1000 / 60) ) {

View File

@ -22,7 +22,7 @@
#define SearchMask (KeyPressMask|ExposureMask) #define SearchMask (KeyPressMask|ExposureMask)
static int _strsubmatch(char *, char *, int); static int strsubmatch(char *, char *, int);
/* /*
* Match: label, title, class. * 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; struct client_ctx *cc = mi->ctx;
/* First, try to match on labels. */ /* 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; cc->matchname = cc->label;
tier = 0; tier = 0;
} }
@ -62,7 +62,7 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search)
/* Then, on window names. */ /* Then, on window names. */
if (tier < 0) { if (tier < 0) {
TAILQ_FOREACH_REVERSE(wn, &cc->nameq, winname_q, entry) 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; cc->matchname = wn->name;
tier = 2; tier = 2;
break; break;
@ -74,7 +74,7 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search)
* name. * name.
*/ */
if (tier < 0 && _strsubmatch(search, cc->app_class, 0)) { if (tier < 0 && strsubmatch(search, cc->app_class, 0)) {
cc->matchname = cc->app_class; cc->matchname = cc->app_class;
tier = 3; tier = 3;
} }
@ -168,7 +168,7 @@ search_match_text(struct menu_q *menuq, struct menu_q *resultq, char *search)
TAILQ_INIT(resultq); TAILQ_INIT(resultq);
TAILQ_FOREACH(mi, menuq, entry) TAILQ_FOREACH(mi, menuq, entry)
if (_strsubmatch(search, mi->text, 0)) if (strsubmatch(search, mi->text, 0))
TAILQ_INSERT_TAIL(resultq, mi, resultentry); 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_INIT(resultq);
TAILQ_FOREACH(mi, menuq, entry) { TAILQ_FOREACH(mi, menuq, entry) {
if (_strsubmatch(search, mi->text, 1) == 0) if (strsubmatch(search, mi->text, 1) == 0)
continue; continue;
for (mj = TAILQ_FIRST(resultq); mj != NULL; for (mj = TAILQ_FIRST(resultq); mj != NULL;
mj = TAILQ_NEXT(mj, resultentry)) { mj = TAILQ_NEXT(mj, resultentry)) {
@ -195,7 +195,7 @@ search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
} }
static int static int
_strsubmatch(char *sub, char *str, int zeroidx) strsubmatch(char *sub, char *str, int zeroidx)
{ {
size_t len, sublen; size_t len, sublen;
u_int n, flen; u_int n, flen;