diff --git a/Makefile b/Makefile index 8573837..0fb1823 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,7 @@ -CFLAGS+= -std=c99 -Wall -Wextra -pedantic -LDADD+= -lX11 -LDFLAGS= -PREFIX?= /usr -BINDIR?= $(PREFIX)/bin +CFLAGS += -std=c99 -Wall -Wextra -pedantic +CFLAGS += -Wmissing-prototypes -Wno-unused-parameter +PREFIX ?= /usr +BINDIR ?= $(PREFIX)/bin CC ?= gcc @@ -12,7 +11,7 @@ config.h: cp config.def.h config.h sowm: sowm.o - $(CC) $(LDFLAGS) -O3 -o $@ $+ $(LDADD) + $(CC) $(LDFLAGS) -O3 -o $@ $+ -lX11 install: all install -Dm 755 sowm $(DESTDIR)$(BINDIR)/sowm diff --git a/sowm.c b/sowm.c index 8066623..958d321 100644 --- a/sowm.c +++ b/sowm.c @@ -79,7 +79,7 @@ void button_press(XEvent *e) { mouse = e->xbutton; } -void button_release() { +void button_release(XEvent *e) { mouse.subwindow = 0; } @@ -120,18 +120,18 @@ void win_del(Window w) { ws_save(ws); } -void win_kill() { +void win_kill(const Arg arg) { if (cur) XKillClient(d, cur->w); } -void win_center() { +void win_center(const Arg arg) { if (!cur) return; win_size(cur->w, &(int){0}, &(int){0}, &ww, &wh); XMoveWindow(d, cur->w, (sw - ww) / 2, (sh - wh) / 2); } -void win_fs() { +void win_fs(const Arg arg) { if (!cur) return; if ((cur->f = cur->f ? 0 : 1)) { @@ -159,14 +159,14 @@ void win_to_ws(const Arg arg) { if (list) win_focus(list); } -void win_prev() { +void win_prev(const Arg arg) { if (!cur) return; XRaiseWindow(d, cur->prev->w); win_focus(cur->prev); } -void win_next() { +void win_next(const Arg arg) { if (!cur) return; XRaiseWindow(d, cur->next->w); @@ -213,7 +213,7 @@ void map_request(XEvent *e) { win_add(w); cur = list->prev; - if (wx + wy == 0) win_center(); + if (wx + wy == 0) win_center((Arg){0}); XMapWindow(d, w); win_focus(list->prev); @@ -259,7 +259,7 @@ int main(void) { if (!(d = XOpenDisplay(0))) exit(1); signal(SIGCHLD, SIG_IGN); - XSetErrorHandler(xerror); + XSetErrorHandler(0); int s = DefaultScreen(d); Window root = RootWindow(d, s); diff --git a/sowm.h b/sowm.h index 8d85083..4ae77f4 100644 --- a/sowm.h +++ b/sowm.h @@ -33,7 +33,7 @@ typedef struct client { } client; void button_press(XEvent *e); -void button_release(); +void button_release(XEvent *e); void configure_request(XEvent *e); void input_grab(Window root); void key_press(XEvent *e); @@ -43,13 +43,12 @@ void notify_enter(XEvent *e); void notify_motion(XEvent *e); void run(const Arg arg); void win_add(Window w); -void win_center(); +void win_center(const Arg arg); void win_del(Window w); -void win_fs(); +void win_fs(const Arg arg); void win_focus(client *c); -void win_kill(); -void win_prev(); -void win_next(); +void win_kill(const Arg arg); +void win_prev(const Arg arg); +void win_next(const Arg arg); void win_to_ws(const Arg arg); void ws_go(const Arg arg); -int xerror() { return 0;}