Skip to content

Commit 273f946

Browse files
authored
released at 0.1.0
1 parent 10ace95 commit 273f946

File tree

4 files changed

+29
-21
lines changed

4 files changed

+29
-21
lines changed

CHANGELOG

+5
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5959
### Fixed
6060
- Window resize lag.
6161
- Bug where window border moves outside of root window.
62+
63+
## [0.1.0] - 2020-11-20
64+
### Fixed
65+
- MISRA 10.4 non-compliance.
66+
- Fix operator dependence.

Makefile

+12-10
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@ CC = cc
33
CFLAGS = -W -O
44
PREFIX = /usr/local
55
LDLIBS = -lm
6-
ALL_LDFLAGS = $(LDFLAGS) $(LIBS) -lxcb -lxcb-keysyms
6+
BINDIR = $(PREFIX)/bin
7+
MANDIR = $(PREFIX)/share/man
8+
LDFLAGS_REQUIRED = -lxcb -lxcb-keysyms
79

810
all: xwm
911
install: all
10-
mkdir -p $(DESTDIR)$(PREFIX)/bin
11-
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
12-
cp -f xwm $(DESTDIR)$(PREFIX)/bin
13-
cp -f xwm.1 $(DESTDIR)$(PREFIX)/share/man/man1
14-
chmod 755 $(DESTDIR)$(PREFIX)/bin/xwm
15-
chmod 644 $(DESTDIR)$(PREFIX)/share/man/man1/xwm.1
12+
mkdir -p $(DESTDIR)$(BINDIR)
13+
mkdir -p $(DESTDIR)$(MANDIR)/man1
14+
cp -f xwm $(DESTDIR)$(BINDIR)
15+
cp -f xwm.1 $(DESTDIR)$(MANDIR)/man1
16+
chmod 755 $(DESTDIR)$(BINDIR)/xwm
17+
chmod 644 $(DESTDIR)$(MANDIR)/man1/xwm.1
1618
xwm: xwm.o
17-
$(CC) $(ALL_LDFLAGS) -o xwm xwm.o $(LDLIBS)
19+
$(CC) $(LDFLAGS_REQUIRED) $(LDFLAGS) -o xwm xwm.o $(LDLIBS)
1820
xwm.o: xwm.c xwm.h config.h
1921
clean:
2022
rm -f xwm *.o
2123
uninstall:
22-
rm -f $(DESTDIR)$(PREFIX)/bin/xwm
23-
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/xwm.1
24+
rm -f $(DESTDIR)$(BINDIR)/xwm
25+
rm -f $(DESTDIR)$(MANDIR)/man1/xwm.1
2426
.PHONY: all install uninstall clean

README

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ BUILD REQUIREMENTS
1212

1313
libxcb, along with any default or user defined utilities:
1414

15-
application launcher dmenu - https://git.suckless.org/dmenu
16-
terminal emulator st - https://git.suckless.org/st
17-
internet browser surf - https://git.suckless.org/surf
15+
application launcher https://git.suckless.org/dmenu
16+
terminal emulator https://git.suckless.org/st
17+
internet browser https://git.suckless.org/surf
1818

1919
COMMANDS
2020
========
2121

22-
The following aliased commands have been implemented (although most
23-
of the default behaviors can be customized via the config.h file):
22+
Default keys and behavior can be customized via the config.h file:
2423

2524
Win+Button1+[drag] interactive window move
2625
Win+Button3+[drag] interactive window resize

xwm.c

+8-6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ static xcb_connection_t * dpy;
99
static xcb_screen_t * scre;
1010
static xcb_drawable_t win;
1111
static uint32_t values[3];
12+
static uint32_t min_x = WINDOW_MIN_X;
13+
static uint32_t min_y = WINDOW_MIN_Y;
1214

1315
static void killclient(char **com) {
1416
xcb_kill_client(dpy, win);
@@ -57,10 +59,10 @@ static void handleMotionNotify(xcb_generic_event_t * ev) {
5759
if ((values[2] == val[0]) && (win != 0)) {
5860
xcb_get_geometry_cookie_t geom_now = xcb_get_geometry(dpy, win);
5961
xcb_get_geometry_reply_t * geom = xcb_get_geometry_reply(dpy, geom_now, NULL);
60-
values[0] = ((poin->root_x + geom->width + 2*BORDER_WIDTH) > scre->width_in_pixels) ?
61-
(scre->width_in_pixels - geom->width - 2*BORDER_WIDTH) : poin->root_x;
62-
values[1] = ((poin->root_y + geom->height + 2*BORDER_WIDTH) > scre->height_in_pixels) ?
63-
(scre->height_in_pixels - geom->height - 2*BORDER_WIDTH) : poin->root_y;
62+
values[0] = ((poin->root_x + geom->width + (2 * BORDER_WIDTH)) > scre->width_in_pixels) ?
63+
(scre->width_in_pixels - geom->width - (2 * BORDER_WIDTH)) : poin->root_x;
64+
values[1] = ((poin->root_y + geom->height + (2 * BORDER_WIDTH)) > scre->height_in_pixels) ?
65+
(scre->height_in_pixels - geom->height - (2 * BORDER_WIDTH)) : poin->root_y;
6466
xcb_configure_window(dpy, win, XCB_CONFIG_WINDOW_X
6567
| XCB_CONFIG_WINDOW_Y, values);
6668
} else if ((values[2] == val[1]) && (win != 0)) {
@@ -69,7 +71,7 @@ static void handleMotionNotify(xcb_generic_event_t * ev) {
6971
if (!((poin->root_x <= geom->x) || (poin->root_y <= geom->y))) {
7072
values[0] = poin->root_x - geom->x - BORDER_WIDTH;
7173
values[1] = poin->root_y - geom->y - BORDER_WIDTH;
72-
if ((values[0] >= WINDOW_MIN_X) && (values[1] >= WINDOW_MIN_Y)) {
74+
if ((values[0] >= min_x) && (values[1] >= min_y)) {
7375
xcb_configure_window(dpy, win, XCB_CONFIG_WINDOW_WIDTH
7476
| XCB_CONFIG_WINDOW_HEIGHT, values);
7577
}
@@ -248,7 +250,7 @@ static int strcmp_c(char * str1, char * str2) {
248250
int main(int argc, char * argv[]) {
249251
int ret = 0;
250252
if ((argc == 2) && (strcmp_c("-v", argv[1]) == 0)) {
251-
ret = die("xwm-0.0.9, © 2020 Michael Czigler, see LICENSE for details\n");
253+
ret = die("xwm-0.1.0, © 2020 Michael Czigler, see LICENSE for details\n");
252254
}
253255
if ((ret == 0) && (argc != 1)) {
254256
ret = die("usage: xwm [-v]\n");

0 commit comments

Comments
 (0)