Skip to content

Commit 05c2465

Browse files
authored
Merge pull request #125 from msharov/master
Remove use of float and math.h
2 parents 6e5ea0c + 3d7fffa commit 05c2465

File tree

6 files changed

+87
-95
lines changed

6 files changed

+87
-95
lines changed

.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
*.o
2-
berry
3-
berryc
1+
.o
42
config.status
53
Config.mk
64
config.h

client.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ struct command {
3838
};
3939
static const struct command command_table[] = {
4040
{ "window_move", IPCWindowMoveRelative, false, 2, fn_int },
41-
{ "window_move_absolute", IPCWindowMoveAbsolute, false, 2, fn_int },
41+
{ "window_move_absolute", IPCWindowMoveAbsolute, false, 2, fn_int },
4242
{ "window_resize", IPCWindowResizeRelative, false, 2, fn_int },
4343
{ "window_resize_absolute", IPCWindowResizeAbsolute, false, 2, fn_int },
4444
{ "window_raise", IPCWindowRaise, false, 0, NULL },
4545
{ "window_monocle", IPCWindowMonocle, false, 0, NULL },
4646
{ "window_close", IPCWindowClose, false, 0, NULL },
4747
{ "window_center", IPCWindowCenter, false, 0, NULL },
4848
{ "focus_color", IPCFocusColor, true, 1, fn_hex },
49-
{ "unfocus_color", IPCUnfocusColor, true, 1, fn_hex },
49+
{ "unfocus_color", IPCUnfocusColor, true, 1, fn_hex },
5050
{ "inner_focus_color", IPCInnerFocusColor, true, 1, fn_hex },
51-
{ "inner_unfocus_color", IPCInnerUnfocusColor, true, 1, fn_hex },
52-
{ "text_focus_color", IPCTitleFocusColor, true, 1, fn_hex },
53-
{ "text_unfocus_color", IPCTitleUnfocusColor, true, 1, fn_hex },
51+
{ "inner_unfocus_color", IPCInnerUnfocusColor, true, 1, fn_hex },
52+
{ "text_focus_color", IPCTitleFocusColor, true, 1, fn_hex },
53+
{ "text_unfocus_color", IPCTitleUnfocusColor, true, 1, fn_hex },
5454
{ "border_width", IPCBorderWidth, true, 1, fn_int },
5555
{ "inner_border_width", IPCInnerBorderWidth, true, 1, fn_int },
5656
{ "title_height", IPCTitleHeight, true, 1, fn_int },
@@ -126,7 +126,7 @@ fn_str(long *data, bool b, int i, char **argv)
126126
/* This function works by setting a new atom globally on the root
127127
* window called BERRY_FONT_PROPERTY which tells berry what font
128128
* to use for window decoration.
129-
* We set the font here in the client and then send a message to
129+
* We set the font here in the client and then send a message to
130130
* berry, notifying the main program to read this value
131131
*/
132132
static void
@@ -137,7 +137,7 @@ fn_font(long *data, bool b, int i, char** argv)
137137
UNUSED(data);
138138
char** font_list;
139139
XTextProperty font_prop;
140-
140+
141141
font_list = malloc(sizeof(char*));
142142
font_list[0] = argv[0];
143143
Xutf8TextListToTextProperty(display, font_list, 1,
@@ -208,7 +208,7 @@ send_command(const struct command *c, int argc, char **argv)
208208
ev.xclient.message_type = XInternAtom(display, BERRY_CLIENT_EVENT, False);
209209
ev.xclient.format = 32;
210210

211-
/* We use the following protocol:
211+
/* We use the following protocol:
212212
* If the given command is related to berry's confid then assign it a value of
213213
* IPCConfig at d[0]. Then, assign the specific config element at d[1], shifting
214214
* all values up by one.
@@ -245,7 +245,7 @@ main(int argc, char **argv)
245245
c_argc = argc - 2;
246246
c_argv = argv + 2;
247247

248-
if (c_argc == -1)
248+
if (c_argc == -1)
249249
return 1;
250250
else if (strcmp(argv[1], "-h") == 0)
251251
usage();

config.h.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
#define MOVE_STEP 40
3232
#define RESIZE_STEP 40
33-
#define PLACE_RES 10
33+
#define PLACE_RES 10
3434

3535
#define TOP_GAP 30
3636
#define BOT_GAP 0

utils.c

-18
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
#include "types.h"
21
#include "utils.h"
3-
#include <math.h>
42
#include <stdio.h>
53
#include <stdlib.h>
6-
#include <X11/Xlib.h>
74

85
int
96
asprintf(char **buf, const char *fmt, ...)
@@ -37,18 +34,3 @@ vasprintf(char **buf, const char *fmt, va_list args)
3734
size = vsprintf(*buf, fmt, args);
3835
return size;
3936
}
40-
41-
int
42-
euclidean_distance(struct client *a, struct client *b)
43-
{
44-
int x_diff, y_diff;
45-
x_diff = a->geom.x - b->geom.x;
46-
y_diff = a->geom.y - b->geom.y;
47-
return pow(x_diff, 2) + pow(y_diff, 2);
48-
}
49-
50-
int
51-
round_k(int n)
52-
{
53-
return ceil(n / 10) * 10;
54-
}

utils.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22
#define _BERRY_UTILS_H_
33

44
#include "types.h"
5-
#include <X11/Xlib.h>
65
#include <stdarg.h>
76

87
#define MAX(a, b) ((a > b) ? (a) : (b))
98
#define MIN(a, b) ((a < b) ? (a) : (b))
109
#define UNUSED(x) (void)(x)
11-
#define LOGN(msg) do { if (debug) fprintf(stderr, __WINDOW_MANAGER_NAME__": " msg "\n"); } while (0)
10+
#define LOGN(msg) do { if (debug) fprintf(stderr, __WINDOW_MANAGER_NAME__": " msg "\n"); } while (0)
1211
#define LOGP(msg, ...) do { if (debug) fprintf(stderr, __WINDOW_MANAGER_NAME__": " msg "\n", __VA_ARGS__); } while (0)
1312

1413
int asprintf(char **buf, const char *fmt, ...);
1514
int vasprintf(char **buf, const char *fmt, va_list args);
16-
int euclidean_distance(struct client *a, struct client *b);
17-
int round_k(int n);
1815

1916
#endif

0 commit comments

Comments
 (0)