Explicitly prototype (void) functions.

This commit is contained in:
Kris Maglione 2007-05-24 17:23:36 -04:00
parent d8adf5a2a8
commit 3b31f2bcca
17 changed files with 828 additions and 842 deletions

View File

@ -1,42 +0,0 @@
The following conditions apply to any distribution which
uses the name wmii. These conditions apply only to wmii
name, and not to its source code or any other materials.
When in doubt about any of these conditions or other matters
of packaging or distrobution, , please contact the wmii
mailing lists <wmii-hackers@suckless.org> or
<wmii@suckless.org>, or Kris Maglione <fbsdaemon@gmail.com>.
Any binary distribution of wmii MUST have a properly set
version string. This string may normally be set in
'mk/wmii.mk', and is set automatically to the Mercurial
revision number for builds from a Mercurial tree, so long as
the 'hg' command is present and properly functioning.
Any version which not an official release or snapshot MUST
be contain the hg revision number in its version string.
This SHOULD be formated as hgXXXX, where XXXX is the decimal
revision number.
The version string of any snapshot release MUST contain the
date of the snapshot in the form YYYYMMDD, and SHOULD
contain the word snap or snapshot. The version string of a
snapshot MAY contain the version of a full release that the
snapshot is expected to lead to, but it MUST be either
directly preceded, or directly followed by, the word 'pre',
optionally separated by a non-alphanumeric character,
including -~_,./, the version.
Any binary distribution which is modified in any non-trivial
way MUST signify the modifications in its name or version
string. This includes patches to use Xft for font display,
but does NOT include minor patches to improve consistency
with the rest of the system, including changing the default
terminal emulator or changing any build flags as set in
config.mk.
Source form distribution MAY include non-trivial patches
without such modifications, provided that the user is made
clearly aware of them at build time and/or prompted in some
way to enable or disable them.

View File

@ -246,11 +246,11 @@ detach_from_area(Frame *f) {
static void
bit_set(uint *field, uint width, uint x, uint y, Bool set) {
enum { devisor = sizeof(uint) * 8 };
enum { divisor = sizeof(uint) * 8 };
uint bx, mask;
bx = x / devisor;
mask = 1 << x % devisor;
bx = x / divisor;
mask = 1 << x % divisor;
if(set)
field[y*width + bx] |= mask;
else
@ -259,18 +259,18 @@ bit_set(uint *field, uint width, uint x, uint y, Bool set) {
static Bool
bit_get(uint *field, uint width, uint x, uint y) {
enum { devisor = sizeof(uint) * 8 };
enum { divisor = sizeof(uint) * 8 };
uint bx, mask;
bx = x / devisor;
mask = 1 << x % devisor;
bx = x / divisor;
mask = 1 << x % divisor;
return (field[y*width + bx] & mask) != 0;
}
static void
place_frame(Frame *f) {
enum { devisor = sizeof(uint) * 8 };
enum { divisor = sizeof(uint) * 8 };
enum { dx = 8, dy = 8 };
static uint mwidth, mx, my;
@ -301,7 +301,7 @@ place_frame(Frame *f) {
if(!field) {
mx = Dx(screen->r) / dx;
my = Dy(screen->r) / dy;
mwidth = ceil((float)mx / devisor);
mwidth = ceil((float)mx / divisor);
field = emallocz(sizeof(uint) * mwidth * my);
}

View File

@ -2,6 +2,7 @@
* Copyright ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
* See LICENSE file for license details.
*/
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@ -10,6 +11,8 @@
#include "dat.h"
#include "fns.h"
#define Mbsearch(k, l, cmp) bsearch(k, l, nelem(l), sizeof(*l), cmp)
static Handlers handlers;
Rectangle gravclient(Client*, Rectangle);
@ -186,7 +189,7 @@ destroy_client(Client *c) {
/* Convenience functions */
Client *
selclient() {
selclient(void) {
if(screen->sel->sel->sel)
return screen->sel->sel->sel->client;
return nil;
@ -325,7 +328,7 @@ focus_client(Client *c) {
Debug fprintf(stderr, "focus_client(%p[%x]) => %s\n", c, clientwin(c), clientname(c));
if(screen->focus != c) {
if((c == nil || !c->noinput) && screen->focus != c) {
Debug fprintf(stderr, "\t%s => %s\n", clientname(screen->focus), clientname(c));
if(c)
@ -566,6 +569,7 @@ prop_client(Client *c, Atom a) {
case XA_WM_HINTS:
wmh = XGetWMHints(display, c->w.w);
if(wmh) {
c->noinput = !((wmh->flags&InputFocus) && wmh->input);
set_urgent(c, (wmh->flags & XUrgencyHint) != 0, False);
XFree(wmh);
}
@ -798,10 +802,21 @@ update_client_views(Client *c, char **tags) {
}
static int
compare_tags(const void *a, const void *b) {
bsstrcmp(const void *a, const void *b) {
return strcmp((char*)a, (char*)b);
}
static int
strpcmp(const void *a, const void *b) {
return strcmp(*(char **)a, *(char **)b);
}
static char *badtags[] = {
".",
"..",
"sel",
};
void
apply_tags(Client *c, const char *tags) {
uint i, j, k, n;
@ -810,8 +825,10 @@ apply_tags(Client *c, const char *tags) {
char *toks[32], *cur;
buf[0] = 0;
for(n = 0; tags[n]; n++)
if(tags[n] != ' ' && tags[n] != '\t') break;
if(!isspace(tags[n]))
break;
if(tags[n] == '+' || tags[n] == '-')
strncpy(buf, c->tags, sizeof(c->tags));
@ -820,7 +837,6 @@ apply_tags(Client *c, const char *tags) {
trim(buf, " \t/");
n = 0;
j = 0;
add = True;
if(buf[0] == '+')
n++;
@ -828,6 +844,8 @@ apply_tags(Client *c, const char *tags) {
n++;
add = False;
}
j = 0;
while(buf[n] && n < sizeof(buf) && j < 32) {
for(i = n; i < sizeof(buf) - 1; i++)
if(buf[i] == '+' || buf[i] == '-' || buf[i] == '\0')
@ -836,14 +854,12 @@ apply_tags(Client *c, const char *tags) {
buf[i] = '\0';
cur = nil;
if(!strncmp(&buf[n], "~", 2))
if(!strcmp(buf+n, "~"))
c->floating = add;
else if(!strncmp(&buf[n], "!", 2))
cur = view ? screen->sel->name : "nil";
else if(strcmp(&buf[n], "sel")
&& strcmp(&buf[n], ".")
&& strcmp(&buf[n], ".."))
cur = &buf[n];
else if(!strcmp(buf+n, "!"))
cur = screen->sel->name;
else if(!Mbsearch(buf+n, badtags, bsstrcmp))
cur = buf+n;
n = i + 1;
if(cur) {
@ -870,14 +886,15 @@ apply_tags(Client *c, const char *tags) {
}
}
c->tags[0] = '\0';
if(!j)
return;
qsort(toks, j, sizeof(char *), compare_tags);
qsort(toks, j, sizeof(char *), strpcmp);
c->tags[0] = '\0';
for(i=0, n=0; i < j; i++)
if(!n || strcmp(toks[i], toks[n-1])) {
if(i)
if(n == 0 || strcmp(toks[i], toks[n-1])) {
if(i > 0)
strlcat(c->tags, "+", sizeof(c->tags));
strlcat(c->tags, toks[i], sizeof(c->tags));
toks[n++] = toks[i];
@ -893,16 +910,17 @@ void
apply_rules(Client *c) {
Rule *r;
regmatch_t rm;
if(strlen(c->tags))
return;
if(def.tagrules.string)
for(r=def.tagrules.rule; r; r=r->next)
if(!regexec(&r->regex, c->props, 1, &rm, 0)) {
apply_tags(c, r->value);
if(strlen(c->tags) && strcmp(c->tags, "nil"))
if(strcmp(c->tags, "nil"))
break;
}
if(!strlen(c->tags))
if(c->tags[0] == '\0')
apply_tags(c, "nil");
}

View File

@ -104,7 +104,7 @@ drawdiv(Divide *d) {
}
void
update_imgs() {
update_imgs(void) {
Divide *d;
int w, h;
@ -133,7 +133,7 @@ update_imgs() {
}
void
update_divs() {
update_divs(void) {
Divide **dp, *d;
Area *a;
View *v;

View File

@ -131,6 +131,7 @@ struct Client {
Bool urgent;
Bool borderless;
Bool titleless;
Bool noinput;
int unmapped;
Window w;
XWindow trans;

View File

@ -17,7 +17,7 @@ void initbar(WMScreen *s);
Bar *create_bar(Bar **b_link, char *name);
void destroy_bar(Bar **b_link, Bar*);
void draw_bar(WMScreen *s);
void resize_bar();
void resize_bar(WMScreen *s);
Bar *bar_of_name(Bar *b_link, const char *name);
/* client.c */
@ -43,7 +43,7 @@ void resize_client(Client*, Rectangle*);
void apply_sizehints(Client*, Rectangle*, Bool floating, Bool frame, Align sticky);
void move_client(Client*, char *arg);
void size_client(Client*, char *arg);
Client *selclient();
Client *selclient(void);
Client *win2client(XWindow);
uint clientwin(Client *c);
char *clientname(Client*);
@ -51,7 +51,7 @@ void apply_rules(Client*);
void apply_tags(Client*, const char*);
/* column.c */
void update_divs();
void update_divs(void);
void draw_div(Divide*);
void setdiv(Divide*, int x);
void arrange_column(Area*, Bool dirty);
@ -74,13 +74,13 @@ void resize_frame(Frame*, Rectangle);
Bool frame_to_top(Frame *f);
void set_frame_cursor(Frame*, Point);
void swap_frames(Frame*, Frame*);
int frame_delta_h();
int frame_delta_h(void);
Rectangle frame_hints(Frame*, Rectangle, Align);
Rectangle frame2client(Frame*, Rectangle);
Rectangle client2frame(Frame*, Rectangle);
int ingrabbox(Frame*, int x, int y);
void draw_frame(Frame*);
void draw_frames();
void draw_frames(void);
void update_frame_widget_colors(Frame*);
Rectangle constrain(Rectangle);
@ -106,8 +106,8 @@ Align get_sticky(Rectangle src, Rectangle dst);
/* key.c */
void kpress(XWindow, ulong mod, KeyCode);
void update_keys();
void init_lock_keys();
void update_keys(void);
void init_lock_keys(void);
ulong str2modmask(char*);
/* map.c */
@ -122,7 +122,7 @@ Area * strarea(View*, char*);
char * message_view(View*, Message*);
char * parse_colors(Message*, CTuple*);
char * message_root(void*, Message*);
char * read_root_ctl();
char * read_root_ctl(void);
char * message_client(Client*, Message*);
char *select_area(Area*, Message*);
char *send_client(View*, Message*, Bool swap);
@ -156,7 +156,7 @@ char *message_view(View *v, Message *m);
void restack_view(View*);
uchar *view_index(View*);
void destroy_view(View*);
void update_views();
void update_views(void);
uint newcolw(View*, int i);
/* wm.c */
@ -172,7 +172,7 @@ Point divpt(Point, Point);
Rectangle insetrect(Rectangle, int);
Rectangle rectaddpt(Rectangle, Point);
Rectangle rectsubpt(Rectangle, Point);
void initdisplay();
void initdisplay(void);
Image * allocimage(int w, int h, int depth);
void freeimage(Image *);
Window *createwindow(Window *parent, Rectangle, int depth, uint class, WinAttr*, int valuemask);
@ -214,7 +214,7 @@ Point querypointer(Window*);
void warppointer(Point);
Point translate(Window*, Window*, Point);
int grabpointer(Window*, Window *confine, Cursor, int mask);
void ungrabpointer();
void ungrabpointer(void);
Rectangle gravitate(Rectangle dst, Rectangle src, Point grav);
Rectangle sizehint(WinHints*, Rectangle);
void sethints(Window*);

View File

@ -285,9 +285,9 @@ resize_frame(Frame *f, Rectangle r) {
}
pt = ZP;
if(!f->client->borderless)
if(!f->client->borderless || !f->area->floating)
pt.y += 1;
if(!f->client->titleless)
if(!f->client->titleless || !f->area->floating)
pt.y += labelh(def.font) - 1;
if(f->area->floating) {
@ -324,7 +324,7 @@ swap_frames(Frame *fa, Frame *fb) {
Client *c;
if(fa == fb) return;
for(fp = &fa->client->frame; *fp; fp = &(*fp)->cnext)
if(*fp == fa) break;
*fp = (*fp)->cnext;
@ -378,7 +378,7 @@ focus_frame(Frame *f, Bool restack) {
}
int
frame_delta_h() {
frame_delta_h(void) {
return def.border + labelh(def.font);
}
@ -438,7 +438,7 @@ draw_frame(Frame *f) {
}
void
draw_frames() {
draw_frames(void) {
Client *c;
for(c=client; c; c=c->next)

View File

@ -135,7 +135,7 @@ static Dirtab *dirtab[] = {
/* Utility Functions */
static FileId *
get_file() {
get_file(void) {
FileId *temp;
if(!free_fileid) {
uint i = 15;

View File

@ -1,4 +1,4 @@
/* Copyright ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
/* Copyright ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
* See LICENSE file for license details.
*/
#include <stdio.h>

View File

@ -9,7 +9,7 @@
#include "fns.h"
void
init_lock_keys() {
init_lock_keys(void) {
XModifierKeymap *modmap;
KeyCode num_lock;
static int masks[] = {
@ -213,7 +213,7 @@ kpress(XWindow w, ulong mod, KeyCode keycode) {
}
void
update_keys() {
update_keys(void) {
Key *k, *n;
char *l, *p;

View File

@ -29,12 +29,12 @@ static struct passwd *passwd;
static int sleeperfd, sock, exitsignal;
static void
usage() {
usage(void) {
fatal("usage: wmii [-a <address>] [-r <wmiirc>] [-v]\n");
}
static void
scan_wins() {
scan_wins(void) {
int i;
uint num;
XWindow *wins;
@ -63,7 +63,7 @@ scan_wins() {
}
static char*
ns_display() {
ns_display(void) {
char *s, *disp;
disp = getenv("DISPLAY");
@ -102,7 +102,7 @@ rmkdir(char *path, int mode) {
}
static void
init_ns() {
init_ns(void) {
struct stat st;
char *s;
@ -131,7 +131,7 @@ init_ns() {
}
static void
init_environment() {
init_environment(void) {
init_ns();
if(address == nil) {
@ -144,7 +144,7 @@ init_environment() {
}
static void
init_atoms() {
init_atoms(void) {
Atom net[] = { xatom("_NET_SUPPORTED"), xatom("_NET_WM_NAME") };
changeprop(&scr.root, "_NET_SUPPORTED", "ATOM", net, nelem(net));
@ -156,7 +156,7 @@ create_cursor(int ident, uint shape) {
}
static void
init_cursors() {
init_cursors(void) {
Pixmap pix;
XColor black, dummy;
@ -218,7 +218,7 @@ init_screen(WMScreen *screen) {
}
static void
cleanup() {
cleanup(void) {
while(client)
destroy_client(client);
ixp_server_close(&srv);
@ -282,7 +282,7 @@ cleanup_handler(int signal) {
}
static void
init_traps() {
init_traps(void) {
char buf[1];
int fd[2];

View File

@ -324,7 +324,7 @@ message_root(void *p, Message *m) {
}
char *
read_root_ctl() {
read_root_ctl(void) {
uint i = 0;
i += snprintf(&buffer[i], (sizeof(buffer) - i), "view %s\n", screen->sel->name);
i += snprintf(&buffer[i], (sizeof(buffer) - i), "focuscolors %s\n", def.focuscolor.colstr);

View File

@ -245,7 +245,7 @@ do_managed_move(Client *c) {
pt2.x = f->area->r.min.x;
pt2.y = pt.y;
fw = framewin(f, pt2, OHoriz, Dx(f->area->r));
r = screen->r;
r.min.y += fw->gb.min.y + Dy(fw->gb)/2;
r.max.y = r.min.y + 1;
@ -415,7 +415,7 @@ mouse_resizecolframe(Frame *f, Align align) {
}
}
if(align&WEST) {
if(a->prev) {
if(a->prev != v->area) {
r.min.x = a->prev->r.min.x + min.x;
r.max.x = a->r.max.x - min.x;
}else {
@ -446,7 +446,7 @@ mouse_resizecolframe(Frame *f, Align align) {
if(!grabpointer(&scr.root, cwin, cursor[CurSizing], MouseMask))
goto done;
pt.x = ((align&WEST) ? f->r.min.x : f->r.max.x);
pt.y = ((align&NORTH) ? f->r.min.y : f->r.max.y);
warppointer(pt);

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1 @@
char *eventtype(XEvent*);
void printevent(XEvent*);

View File

@ -371,7 +371,7 @@ view_index(View *v) {
}
void
update_views() {
update_views(void) {
View *n, *v, *old;
Bool found;

View File

@ -96,7 +96,7 @@ rectsubpt(Rectangle r, Point p) {
/* Init */
void
initdisplay() {
initdisplay(void) {
display = XOpenDisplay(nil);
scr.screen = DefaultScreen(display);
scr.colormap = DefaultColormap(display, scr.screen);
@ -654,7 +654,7 @@ grabpointer(Window *w, Window *confine, Cursor cur, int mask) {
}
void
ungrabpointer() {
ungrabpointer(void) {
XUngrabPointer(display, CurrentTime);
}