Get rid of GNU_SOURCE (issue #625)
This commit is contained in:
parent
468bc16b0f
commit
4a5f0a7d83
5 changed files with 13 additions and 10 deletions
|
@ -82,7 +82,7 @@ if( NOT IMLIB_BUILD_WITH_X )
|
||||||
message( FATAL_ERROR "Imlib is not built with X support" )
|
message( FATAL_ERROR "Imlib is not built with X support" )
|
||||||
endif( NOT IMLIB_BUILD_WITH_X )
|
endif( NOT IMLIB_BUILD_WITH_X )
|
||||||
|
|
||||||
add_definitions( -D_GNU_SOURCE )
|
add_definitions( -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE )
|
||||||
|
|
||||||
include_directories( ${PROJECT_BINARY_DIR}
|
include_directories( ${PROJECT_BINARY_DIR}
|
||||||
src
|
src
|
||||||
|
|
|
@ -188,6 +188,7 @@ void draw_separator_line(void *obj, cairo_t *c)
|
||||||
|
|
||||||
void draw_separator_dots(void *obj, cairo_t *c)
|
void draw_separator_dots(void *obj, cairo_t *c)
|
||||||
{
|
{
|
||||||
|
const double PI = 3.14159265359;
|
||||||
Separator *separator = (Separator *)obj;
|
Separator *separator = (Separator *)obj;
|
||||||
if (separator->thickness <= 0)
|
if (separator->thickness <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -214,14 +215,14 @@ void draw_separator_dots(void *obj, cairo_t *c)
|
||||||
offset + separator->thickness / 2.0,
|
offset + separator->thickness / 2.0,
|
||||||
separator->thickness / 2.0,
|
separator->thickness / 2.0,
|
||||||
0,
|
0,
|
||||||
2 * M_PI);
|
2 * PI);
|
||||||
} else {
|
} else {
|
||||||
cairo_arc(c,
|
cairo_arc(c,
|
||||||
offset + separator->thickness / 2.0,
|
offset + separator->thickness / 2.0,
|
||||||
separator->area.height / 2.0,
|
separator->area.height / 2.0,
|
||||||
separator->thickness / 2.0,
|
separator->thickness / 2.0,
|
||||||
0,
|
0,
|
||||||
2 * M_PI);
|
2 * PI);
|
||||||
}
|
}
|
||||||
cairo_stroke_preserve(c);
|
cairo_stroke_preserve(c);
|
||||||
cairo_fill(c);
|
cairo_fill(c);
|
||||||
|
|
|
@ -256,7 +256,7 @@ void get_root_pixmap()
|
||||||
gcv.ts_x_origin = 0;
|
gcv.ts_x_origin = 0;
|
||||||
gcv.ts_y_origin = 0;
|
gcv.ts_y_origin = 0;
|
||||||
gcv.fill_style = FillTiled;
|
gcv.fill_style = FillTiled;
|
||||||
uint mask = GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle | GCTile;
|
unsigned mask = GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle | GCTile;
|
||||||
|
|
||||||
gcv.tile = server.root_pmap;
|
gcv.tile = server.root_pmap;
|
||||||
XChangeGC(server.display, server.gc, mask, &gcv);
|
XChangeGC(server.display, server.gc, mask, &gcv);
|
||||||
|
|
|
@ -301,8 +301,8 @@ void task_update_icon(Task *task)
|
||||||
// get width, height and depth for the pixmap
|
// get width, height and depth for the pixmap
|
||||||
Window root;
|
Window root;
|
||||||
int icon_x, icon_y;
|
int icon_x, icon_y;
|
||||||
uint border_width, bpp;
|
unsigned border_width, bpp;
|
||||||
uint w, h;
|
unsigned w, h;
|
||||||
|
|
||||||
XGetGeometry(server.display, hints->icon_pixmap, &root, &icon_x, &icon_y, &w, &h, &border_width, &bpp);
|
XGetGeometry(server.display, hints->icon_pixmap, &root, &icon_x, &icon_y, &w, &h, &border_width, &bpp);
|
||||||
imlib_context_set_drawable(hints->icon_pixmap);
|
imlib_context_set_drawable(hints->icon_pixmap);
|
||||||
|
|
|
@ -449,9 +449,9 @@ Imlib_Image load_image(const char *path, int cached)
|
||||||
}
|
}
|
||||||
if (!image && g_str_has_suffix(path, ".svg")) {
|
if (!image && g_str_has_suffix(path, ".svg")) {
|
||||||
char tmp_filename[128];
|
char tmp_filename[128];
|
||||||
sprintf(tmp_filename, "/tmp/tint2-%d-XXXXXX.png", (int)getpid());
|
sprintf(tmp_filename, "/tmp/tint2-%d.png", (int)getpid());
|
||||||
int fd = mkstemps(tmp_filename, 4);
|
int fd = open(tmp_filename, O_CREAT | O_EXCL, 0600);
|
||||||
if (fd) {
|
if (fd >= 0) {
|
||||||
// We fork here because librsvg allocates memory like crazy
|
// We fork here because librsvg allocates memory like crazy
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
|
@ -469,6 +469,7 @@ Imlib_Image load_image(const char *path, int cached)
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
// Parent
|
// Parent
|
||||||
|
close(fd);
|
||||||
waitpid(pid, 0, 0);
|
waitpid(pid, 0, 0);
|
||||||
image = imlib_load_image_immediately_without_cache(tmp_filename);
|
image = imlib_load_image_immediately_without_cache(tmp_filename);
|
||||||
unlink(tmp_filename);
|
unlink(tmp_filename);
|
||||||
|
@ -639,7 +640,8 @@ GSList *load_locations_from_env(GSList *locations, const char *var, ...)
|
||||||
if (value) {
|
if (value) {
|
||||||
value = strdup(value);
|
value = strdup(value);
|
||||||
char *p = value;
|
char *p = value;
|
||||||
for (char *token = strsep(&value, ":"); token; token = strsep(&value, ":")) {
|
char *t;
|
||||||
|
for (char *token = strtok_r(value, ":", &t); token; token = strtok_r(NULL, ":", &t)) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, var);
|
va_start(ap, var);
|
||||||
for (const char *suffix = va_arg(ap, const char *); suffix; suffix = va_arg(ap, const char *)) {
|
for (const char *suffix = va_arg(ap, const char *); suffix; suffix = va_arg(ap, const char *)) {
|
||||||
|
|
Loading…
Reference in a new issue