mirror of
https://github.com/dylanaraps/sowm.git
synced 2025-05-19 01:20:23 -07:00
sowm: proper prototypes
This commit is contained in:
parent
a31091472a
commit
69f2c71fb7
11
Makefile
11
Makefile
@ -1,8 +1,7 @@
|
|||||||
CFLAGS+= -std=c99 -Wall -Wextra -pedantic
|
CFLAGS += -std=c99 -Wall -Wextra -pedantic
|
||||||
LDADD+= -lX11
|
CFLAGS += -Wmissing-prototypes -Wno-unused-parameter
|
||||||
LDFLAGS=
|
PREFIX ?= /usr
|
||||||
PREFIX?= /usr
|
BINDIR ?= $(PREFIX)/bin
|
||||||
BINDIR?= $(PREFIX)/bin
|
|
||||||
|
|
||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
|
|
||||||
@ -12,7 +11,7 @@ config.h:
|
|||||||
cp config.def.h config.h
|
cp config.def.h config.h
|
||||||
|
|
||||||
sowm: sowm.o
|
sowm: sowm.o
|
||||||
$(CC) $(LDFLAGS) -O3 -o $@ $+ $(LDADD)
|
$(CC) $(LDFLAGS) -O3 -o $@ $+ -lX11
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
install -Dm 755 sowm $(DESTDIR)$(BINDIR)/sowm
|
install -Dm 755 sowm $(DESTDIR)$(BINDIR)/sowm
|
||||||
|
16
sowm.c
16
sowm.c
@ -79,7 +79,7 @@ void button_press(XEvent *e) {
|
|||||||
mouse = e->xbutton;
|
mouse = e->xbutton;
|
||||||
}
|
}
|
||||||
|
|
||||||
void button_release() {
|
void button_release(XEvent *e) {
|
||||||
mouse.subwindow = 0;
|
mouse.subwindow = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,18 +120,18 @@ void win_del(Window w) {
|
|||||||
ws_save(ws);
|
ws_save(ws);
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_kill() {
|
void win_kill(const Arg arg) {
|
||||||
if (cur) XKillClient(d, cur->w);
|
if (cur) XKillClient(d, cur->w);
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_center() {
|
void win_center(const Arg arg) {
|
||||||
if (!cur) return;
|
if (!cur) return;
|
||||||
|
|
||||||
win_size(cur->w, &(int){0}, &(int){0}, &ww, &wh);
|
win_size(cur->w, &(int){0}, &(int){0}, &ww, &wh);
|
||||||
XMoveWindow(d, cur->w, (sw - ww) / 2, (sh - wh) / 2);
|
XMoveWindow(d, cur->w, (sw - ww) / 2, (sh - wh) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_fs() {
|
void win_fs(const Arg arg) {
|
||||||
if (!cur) return;
|
if (!cur) return;
|
||||||
|
|
||||||
if ((cur->f = cur->f ? 0 : 1)) {
|
if ((cur->f = cur->f ? 0 : 1)) {
|
||||||
@ -159,14 +159,14 @@ void win_to_ws(const Arg arg) {
|
|||||||
if (list) win_focus(list);
|
if (list) win_focus(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_prev() {
|
void win_prev(const Arg arg) {
|
||||||
if (!cur) return;
|
if (!cur) return;
|
||||||
|
|
||||||
XRaiseWindow(d, cur->prev->w);
|
XRaiseWindow(d, cur->prev->w);
|
||||||
win_focus(cur->prev);
|
win_focus(cur->prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_next() {
|
void win_next(const Arg arg) {
|
||||||
if (!cur) return;
|
if (!cur) return;
|
||||||
|
|
||||||
XRaiseWindow(d, cur->next->w);
|
XRaiseWindow(d, cur->next->w);
|
||||||
@ -213,7 +213,7 @@ void map_request(XEvent *e) {
|
|||||||
win_add(w);
|
win_add(w);
|
||||||
cur = list->prev;
|
cur = list->prev;
|
||||||
|
|
||||||
if (wx + wy == 0) win_center();
|
if (wx + wy == 0) win_center((Arg){0});
|
||||||
|
|
||||||
XMapWindow(d, w);
|
XMapWindow(d, w);
|
||||||
win_focus(list->prev);
|
win_focus(list->prev);
|
||||||
@ -259,7 +259,7 @@ int main(void) {
|
|||||||
if (!(d = XOpenDisplay(0))) exit(1);
|
if (!(d = XOpenDisplay(0))) exit(1);
|
||||||
|
|
||||||
signal(SIGCHLD, SIG_IGN);
|
signal(SIGCHLD, SIG_IGN);
|
||||||
XSetErrorHandler(xerror);
|
XSetErrorHandler(0);
|
||||||
|
|
||||||
int s = DefaultScreen(d);
|
int s = DefaultScreen(d);
|
||||||
Window root = RootWindow(d, s);
|
Window root = RootWindow(d, s);
|
||||||
|
13
sowm.h
13
sowm.h
@ -33,7 +33,7 @@ typedef struct client {
|
|||||||
} client;
|
} client;
|
||||||
|
|
||||||
void button_press(XEvent *e);
|
void button_press(XEvent *e);
|
||||||
void button_release();
|
void button_release(XEvent *e);
|
||||||
void configure_request(XEvent *e);
|
void configure_request(XEvent *e);
|
||||||
void input_grab(Window root);
|
void input_grab(Window root);
|
||||||
void key_press(XEvent *e);
|
void key_press(XEvent *e);
|
||||||
@ -43,13 +43,12 @@ void notify_enter(XEvent *e);
|
|||||||
void notify_motion(XEvent *e);
|
void notify_motion(XEvent *e);
|
||||||
void run(const Arg arg);
|
void run(const Arg arg);
|
||||||
void win_add(Window w);
|
void win_add(Window w);
|
||||||
void win_center();
|
void win_center(const Arg arg);
|
||||||
void win_del(Window w);
|
void win_del(Window w);
|
||||||
void win_fs();
|
void win_fs(const Arg arg);
|
||||||
void win_focus(client *c);
|
void win_focus(client *c);
|
||||||
void win_kill();
|
void win_kill(const Arg arg);
|
||||||
void win_prev();
|
void win_prev(const Arg arg);
|
||||||
void win_next();
|
void win_next(const Arg arg);
|
||||||
void win_to_ws(const Arg arg);
|
void win_to_ws(const Arg arg);
|
||||||
void ws_go(const Arg arg);
|
void ws_go(const Arg arg);
|
||||||
int xerror() { return 0;}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user