mfwm

A tiling fork of dylanaraps sowm.
git clone git://depsterr.com/git/mfwm
Log | Files | Refs | README | LICENSE

commit 5668ad125973861ce411b75b4558aa4044fa8710
parent c4e64e27b722736df04aa37e4f1fffe658e32793
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Tue, 15 Oct 2019 19:45:24 +0300

sowm: fixed all compiler warnings.

Diffstat:
MMakefile | 4++--
Mconfig.def.h | 2+-
Msowm.c | 21++++++++++-----------
3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,4 +1,4 @@ -CFLAGS+= -std=c99 -Wall -Wno-deprecated-declarations -pedantic +CFLAGS+= -std=c99 -Wall -Wextra -pedantic -Wno-deprecated-declarations LDADD+= -lX11 LDFLAGS= PREFIX?= /usr @@ -12,7 +12,7 @@ config.h: cp config.def.h config.h sowm: sowm.o - $(CC) $(LDFLAGS) -Os -o $@ $+ $(LDADD) + $(CC) $(LDFLAGS) -O3 -o $@ $+ $(LDADD) install: all install -Dm 755 sowm $(DESTDIR)$(BINDIR)/sowm diff --git a/config.def.h b/config.def.h @@ -15,7 +15,7 @@ const char* colors[] = {"bud", "/home/goldie/Pictures/Wallpapers", 0}; static struct key keys[] = { {MOD, XK_q, win_kill, {0}}, - {MOD, XK_c, win_center, {.i = 0}}, + {MOD, XK_c, win_center, {.w = 0}}, {MOD, XK_f, win_fs, {0}}, {Mod1Mask, XK_Tab, win_next, {0}}, diff --git a/sowm.c b/sowm.c @@ -23,6 +23,7 @@ typedef union { const char** com; const int i; + const Window w; } Arg; struct key { @@ -66,7 +67,7 @@ static void ws_sel(int i); static client *list = {0}; static desktop ws_list[10]; -static int ws = 1, sh, sw, s, j; +static int ws = 1, sh, sw, s; static Display *d; static Window root, cur; @@ -110,7 +111,7 @@ static void (*events[LASTEvent])(XEvent *e) = { the same value can be used as a variable directly afterwards. */ Window win_current() { - XGetInputFocus(d, &cur, &j); + XGetInputFocus(d, &cur, (int[]){1}); return cur; } @@ -193,7 +194,7 @@ void notify_motion(XEvent *e) { void key_grab() { KeyCode code; - for (int i=0; i < sizeof(keys)/sizeof(*keys); ++i) + for (unsigned int i=0; i < sizeof(keys)/sizeof(*keys); ++i) if ((code = XKeysymToKeycode(d, keys[i].keysym))) XGrabKey(d, code, keys[i].mod, root, True, GrabModeAsync, GrabModeAsync); @@ -214,7 +215,7 @@ void key_grab() { void key_press(XEvent *e) { KeySym keysym = XKeycodeToKeysym(d, e->xkey.keycode, 0); - for (int i=0; i < sizeof(keys)/sizeof(*keys); ++i) + for (unsigned int i=0; i < sizeof(keys)/sizeof(*keys); ++i) if (keys[i].keysym == keysym && keys[i].mod == e->xkey.state) keys[i].function(keys[i].arg); } @@ -258,8 +259,7 @@ void win_add(Window w) { exit(1); if (!list) { - c->next = 0; - c->prev = 0; + c->next = c->prev = 0; c->w = w; list = c; @@ -335,7 +335,7 @@ void win_kill() { currently focused window. */ void win_center(const Arg arg) { - Window w = arg.i ? arg.i : win_current(); + Window w = arg.w ? arg.w : win_current(); XGetWindowAttributes(d, w, &attr); @@ -468,7 +468,7 @@ void ws_save(int i) { */ void ws_sel(int i) { list = ws_list[i].list; - ws = i; + ws = i; } /* @@ -508,6 +508,7 @@ void map_request(XEvent *e) { XSelectInput(d, w, PropertyChangeMask|StructureNotifyMask| EnterWindowMask|FocusChangeMask); + win_center((Arg){.i = w}); XMapWindow(d, w); FOC(w); @@ -535,9 +536,7 @@ void run(const Arg arg) { The only errors which are handled are failed memory allocations or a failure to open the display on start. */ -int xerror(Display *d, XErrorEvent *e) { - return 0; -} +int xerror() { return 0; } /* Initialize the window manager by registering all