Skip to content

Commit a730ba3

Browse files
authored
released at 0.1.1
1 parent 273f946 commit a730ba3

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

CHANGELOG

+4
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6464
### Fixed
6565
- MISRA 10.4 non-compliance.
6666
- Fix operator dependence.
67+
68+
## [0.1.1] - 2020-11-21
69+
### Added
70+
- Makefile warnings (e.g. -Wall, Wextra, etc.).

Makefile

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
.POSIX:
2-
CC = cc
3-
CFLAGS = -W -O
2+
ALL_WARNING = -Wall -Wextra -pedantic
3+
ALL_LDFLAGS = -lxcb -lxcb-keysyms $(LDFLAGS)
4+
ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS) -std=c99 $(ALL_WARNING)
45
PREFIX = /usr/local
56
LDLIBS = -lm
67
BINDIR = $(PREFIX)/bin
78
MANDIR = $(PREFIX)/share/man
8-
LDFLAGS_REQUIRED = -lxcb -lxcb-keysyms
99

1010
all: xwm
1111
install: all
@@ -16,8 +16,9 @@ install: all
1616
chmod 755 $(DESTDIR)$(BINDIR)/xwm
1717
chmod 644 $(DESTDIR)$(MANDIR)/man1/xwm.1
1818
xwm: xwm.o
19-
$(CC) $(LDFLAGS_REQUIRED) $(LDFLAGS) -o xwm xwm.o $(LDLIBS)
19+
$(CC) $(ALL_LDFLAGS) -o xwm xwm.o $(LDLIBS)
2020
xwm.o: xwm.c xwm.h config.h
21+
$(CC) $(ALL_CFLAGS) -c xwm.c
2122
clean:
2223
rm -f xwm *.o
2324
uninstall:

xwm.c

+13-7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include "xwm.h"
66
#include "config.h"
77

8+
#define UNUSED(x) (void)(x)
9+
810
static xcb_connection_t * dpy;
911
static xcb_screen_t * scre;
1012
static xcb_drawable_t win;
@@ -13,10 +15,12 @@ static uint32_t min_x = WINDOW_MIN_X;
1315
static uint32_t min_y = WINDOW_MIN_Y;
1416

1517
static void killclient(char **com) {
18+
UNUSED(com);
1619
xcb_kill_client(dpy, win);
1720
}
1821

1922
static void closewm(char **com) {
23+
UNUSED(com);
2024
if (dpy != NULL) {
2125
xcb_disconnect(dpy);
2226
}
@@ -53,6 +57,7 @@ static void handleButtonPress(xcb_generic_event_t * ev) {
5357
}
5458

5559
static void handleMotionNotify(xcb_generic_event_t * ev) {
60+
UNUSED(ev);
5661
xcb_query_pointer_cookie_t coord = xcb_query_pointer(dpy, scre->root);
5762
xcb_query_pointer_reply_t * poin = xcb_query_pointer_reply(dpy, coord, 0);
5863
uint32_t val[2] = {1, 3};
@@ -149,13 +154,10 @@ static void handleEnterNotify(xcb_generic_event_t * ev) {
149154
}
150155

151156
static void handleButtonRelease(xcb_generic_event_t * ev) {
157+
UNUSED(ev);
152158
xcb_ungrab_pointer(dpy, XCB_CURRENT_TIME);
153159
}
154160

155-
static void handleKeyRelease(xcb_generic_event_t * ev) {
156-
/* nothing to see here, carry on */
157-
}
158-
159161
static void handleDestroyNotify(xcb_generic_event_t * ev) {
160162
xcb_destroy_notify_event_t * e = (xcb_destroy_notify_event_t *) ev;
161163
xcb_kill_client(dpy, e->window);
@@ -232,8 +234,12 @@ static int die(char * errstr) {
232234
while ((* (p++)) != 0) {
233235
++n;
234236
}
235-
write(STDERR_FILENO, errstr, n);
236-
return 1;
237+
ssize_t o = write(STDERR_FILENO, errstr, n);
238+
int ret = 1;
239+
if (o < 0) {
240+
ret = -1;
241+
}
242+
return ret;
237243
}
238244

239245
static int strcmp_c(char * str1, char * str2) {
@@ -250,7 +256,7 @@ static int strcmp_c(char * str1, char * str2) {
250256
int main(int argc, char * argv[]) {
251257
int ret = 0;
252258
if ((argc == 2) && (strcmp_c("-v", argv[1]) == 0)) {
253-
ret = die("xwm-0.1.0, © 2020 Michael Czigler, see LICENSE for details\n");
259+
ret = die("xwm-0.1.1, © 2020 Michael Czigler, see LICENSE for details\n");
254260
}
255261
if ((ret == 0) && (argc != 1)) {
256262
ret = die("usage: xwm [-v]\n");

xwm.h

-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ static void handleDestroyNotify(xcb_generic_event_t * ev);
3636
static void handleButtonPress(xcb_generic_event_t * ev);
3737
static void handleButtonRelease(xcb_generic_event_t * ev);
3838
static void handleKeyPress(xcb_generic_event_t * ev);
39-
static void handleKeyRelease(xcb_generic_event_t * ev);
4039
static void handleMapRequest(xcb_generic_event_t * ev);
4140
static void handleFocusIn(xcb_generic_event_t * ev);
4241
static void handleFocusOut(xcb_generic_event_t * ev);
@@ -47,7 +46,6 @@ static handler_func_t handler_funs[] = {
4746
{ XCB_BUTTON_PRESS, handleButtonPress },
4847
{ XCB_BUTTON_RELEASE, handleButtonRelease },
4948
{ XCB_KEY_PRESS, handleKeyPress },
50-
{ XCB_KEY_RELEASE, handleKeyRelease },
5149
{ XCB_MAP_REQUEST, handleMapRequest },
5250
{ XCB_FOCUS_IN, handleFocusIn },
5351
{ XCB_FOCUS_OUT, handleFocusOut },

0 commit comments

Comments
 (0)