From f041981121a18d2b5c0697db9469c8c6ab474386 Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 26 Jun 2009 12:21:58 +0000 Subject: static local functions and data; almost identical diff from Thomas Pfaff ok oga@ --- calmwm.c | 15 +++++++-------- calmwm.h | 11 +---------- client.c | 22 ++++++++++++++-------- conf.c | 13 ++++++++----- menu.c | 6 +++--- screen.c | 3 +-- xutil.c | 4 ++-- 7 files changed, 36 insertions(+), 38 deletions(-) diff --git a/calmwm.c b/calmwm.c index 4644601..a656823 100644 --- a/calmwm.c +++ b/calmwm.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.c,v 1.41 2009/06/23 21:52:38 okan Exp $ + * $Id: calmwm.c,v 1.42 2009/06/26 12:21:58 okan Exp $ */ #include "headers.h" @@ -40,6 +40,7 @@ struct conf Conf; static void sigchld_cb(int); static void dpy_init(const char *); +static int x_errorhandler(Display *, XErrorEvent *); static void x_setup(void); static void x_setupscreen(struct screen_ctx *, u_int); static void x_teardown(void); @@ -89,7 +90,7 @@ main(int argc, char **argv) return (0); } -void +static void dpy_init(const char *dpyname) { int i; @@ -103,7 +104,7 @@ dpy_init(const char *dpyname) HasRandr = XRRQueryExtension(X_Dpy, &Randr_ev, &i); } -void +static void x_setup(void) { struct screen_ctx *sc; @@ -130,7 +131,7 @@ x_setup(void) Cursor_question = XCreateFontCursor(X_Dpy, XC_question_arrow); } -void +static void x_teardown(void) { struct screen_ctx *sc; @@ -141,7 +142,7 @@ x_teardown(void) XCloseDisplay(X_Dpy); } -void +static void x_setupscreen(struct screen_ctx *sc, u_int which) { Window *wins, w0, w1; @@ -200,11 +201,9 @@ x_setupscreen(struct screen_ctx *sc, u_int which) screen_init_xinerama(sc); XSync(X_Dpy, False); - - return; } -int +static int x_errorhandler(Display *dpy, XErrorEvent *e) { #ifdef DEBUG diff --git a/calmwm.h b/calmwm.h index ba45615..87108e3 100644 --- a/calmwm.h +++ b/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.h,v 1.93 2009/06/23 21:52:38 okan Exp $ + * $Id: calmwm.h,v 1.94 2009/06/26 12:21:58 okan Exp $ */ #ifndef _CALMWM_H_ @@ -324,7 +324,6 @@ struct mwm_hints { int input_keycodetrans(KeyCode, u_int, enum ctltype *, char *); -int x_errorhandler(Display *, XErrorEvent *); __dead void usage(void); struct client_ctx *client_find(Window); @@ -346,17 +345,11 @@ void client_warp(struct client_ctx *); void client_ptrwarp(struct client_ctx *); void client_ptrsave(struct client_ctx *); void client_draw_border(struct client_ctx *); -void client_update(struct client_ctx *); -void client_placecalc(struct client_ctx *); void client_maximize(struct client_ctx *); void client_vertmaximize(struct client_ctx *); void client_map(struct client_ctx *); void client_mtf(struct client_ctx *); struct client_ctx *client_cycle(int); -struct client_ctx *client_mrunext(struct client_ctx *); -struct client_ctx *client_mruprev(struct client_ctx *); -void client_gethints(struct client_ctx *); -void client_freehints(struct client_ctx *); struct menu *menu_filter(struct menu_q *, char *, char *, int, void (*)(struct menu_q *, struct menu_q *, char *), @@ -407,9 +400,7 @@ void conf_client(struct client_ctx *); void conf_grab(struct conf *, struct keybinding *); void conf_ungrab(struct conf *, struct keybinding *); void conf_bindname(struct conf *, char *, char *); -void conf_unbind(struct conf *, struct keybinding *); void conf_mousebind(struct conf *, char *, char *); -void conf_mouseunbind(struct conf *, struct mousebinding *); void conf_grab_mouse(struct client_ctx *); void conf_reload(struct conf *); void conf_font(struct conf *); diff --git a/client.c b/client.c index a090d8d..531bff8 100644 --- a/client.c +++ b/client.c @@ -15,13 +15,19 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: client.c,v 1.56 2009/06/23 21:52:38 okan Exp $ + * $Id: client.c,v 1.57 2009/06/26 12:21:58 okan Exp $ */ #include "headers.h" #include "calmwm.h" -static int client_inbound(struct client_ctx *, int, int); +static struct client_ctx *client_mrunext(struct client_ctx *); +static struct client_ctx *client_mruprev(struct client_ctx *); +static void client_placecalc(struct client_ctx *); +static void client_update(struct client_ctx *); +static void client_gethints(struct client_ctx *); +static void client_freehints(struct client_ctx *); +static int client_inbound(struct client_ctx *, int, int); static char emptystring[] = ""; struct client_ctx *_curcc = NULL; @@ -407,7 +413,7 @@ client_draw_border(struct client_ctx *cc) XSetWindowBorder(X_Dpy, cc->win, pixel); } -void +static void client_update(struct client_ctx *cc) { Atom *p; @@ -522,7 +528,7 @@ client_cycle(int reverse) return (newcc); } -struct client_ctx * +static struct client_ctx * client_mrunext(struct client_ctx *cc) { struct screen_ctx *sc = CCTOSC(cc); @@ -532,7 +538,7 @@ client_mrunext(struct client_ctx *cc) ccc : TAILQ_FIRST(&sc->mruq)); } -struct client_ctx * +static struct client_ctx * client_mruprev(struct client_ctx *cc) { struct screen_ctx *sc = CCTOSC(cc); @@ -542,7 +548,7 @@ client_mruprev(struct client_ctx *cc) ccc : TAILQ_LAST(&sc->mruq, cycle_entry_q)); } -void +static void client_placecalc(struct client_ctx *cc) { struct screen_ctx *sc = CCTOSC(cc); @@ -629,7 +635,7 @@ client_mtf(struct client_ctx *cc) TAILQ_INSERT_HEAD(&sc->mruq, cc, mru_entry); } -void +static void client_gethints(struct client_ctx *cc) { XClassHint xch; @@ -675,7 +681,7 @@ client_gethints(struct client_ctx *cc) } } -void +static void client_freehints(struct client_ctx *cc) { if (cc->app_name != NULL) diff --git a/conf.c b/conf.c index fdf9e60..91df027 100644 --- a/conf.c +++ b/conf.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: conf.c,v 1.65 2009/06/20 00:22:39 okan Exp $ + * $Id: conf.c,v 1.66 2009/06/26 12:21:58 okan Exp $ */ #include "headers.h" @@ -28,6 +28,9 @@ ((tsp)->tv_sec cmp (usp)->tv_sec)) #endif +static void conf_mouseunbind(struct conf *, struct mousebinding *); +static void conf_unbind(struct conf *, struct keybinding *); + extern struct screen_ctx *Curscreen; /* Add an command menu entry to the end of the menu */ @@ -278,7 +281,7 @@ conf_client(struct client_ctx *cc) cc->flags |= ignore ? CLIENT_IGNORE : 0; } -struct { +static struct { char *tag; void (*handler)(struct client_ctx *, union arg *); int flags; @@ -493,7 +496,7 @@ conf_bindname(struct conf *c, char *name, char *binding) return; } -void +static void conf_unbind(struct conf *c, struct keybinding *unbind) { struct keybinding *key = NULL, *keynxt; @@ -515,7 +518,7 @@ conf_unbind(struct conf *c, struct keybinding *unbind) } } -struct { +static struct { char *tag; void (*handler)(struct client_ctx *, void *); int context; @@ -583,7 +586,7 @@ conf_mousebind(struct conf *c, char *name, char *binding) } } -void +static void conf_mouseunbind(struct conf *c, struct mousebinding *unbind) { struct mousebinding *mb = NULL, *mbnxt; diff --git a/menu.c b/menu.c index ea4a24f..477016e 100644 --- a/menu.c +++ b/menu.c @@ -43,7 +43,7 @@ static struct menu *menu_handle_key(XEvent *, struct menu_ctx *, struct menu_q *, struct menu_q *); static void menu_handle_move(XEvent *, struct menu_ctx *, struct screen_ctx *); -struct menu *menu_handle_release(XEvent *, struct menu_ctx *, +static struct menu *menu_handle_release(XEvent *, struct menu_ctx *, struct screen_ctx *, struct menu_q *); static void menu_draw(struct screen_ctx *, struct menu_ctx *, struct menu_q *, struct menu_q *); @@ -349,7 +349,7 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq, 0, 0, mc->width, font_height()); } -void +static void menu_handle_move(XEvent *e, struct menu_ctx *mc, struct screen_ctx *sc) { mc->prev = mc->entry; @@ -366,7 +366,7 @@ menu_handle_move(XEvent *e, struct menu_ctx *mc, struct screen_ctx *sc) xu_ptr_regrab(MenuGrabMask, Cursor_default); } -struct menu * +static struct menu * menu_handle_release(XEvent *e, struct menu_ctx *mc, struct screen_ctx *sc, struct menu_q *resultq) { diff --git a/screen.c b/screen.c index 8ac3da4..d1a5e1b 100644 --- a/screen.c +++ b/screen.c @@ -15,13 +15,12 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: screen.c,v 1.15 2009/06/23 21:52:38 okan Exp $ + * $Id: screen.c,v 1.16 2009/06/26 12:21:58 okan Exp $ */ #include "headers.h" #include "calmwm.h" -extern struct screen_ctx_q Screenq; extern struct screen_ctx *Curscreen; void diff --git a/xutil.c b/xutil.c index 6bb40bc..551075e 100644 --- a/xutil.c +++ b/xutil.c @@ -15,13 +15,13 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: xutil.c,v 1.16 2009/06/17 13:08:37 okan Exp $ + * $Id: xutil.c,v 1.17 2009/06/26 12:21:58 okan Exp $ */ #include "headers.h" #include "calmwm.h" -unsigned int ign_mods[] = { 0, LockMask, Mod2Mask, Mod2Mask | LockMask }; +static unsigned int ign_mods[] = { 0, LockMask, Mod2Mask, Mod2Mask | LockMask }; int xu_ptr_grab(Window win, int mask, Cursor curs) -- cgit v1.2.3-2-gb3c3