expanded file name size (comparisons were failing)

This commit is contained in:
Bram Wasti 2015-01-07 15:46:59 -05:00
parent 5c5bb41cd0
commit a6c37d1f6d

62
bar.c
View File

@ -36,7 +36,7 @@ typedef struct area_t {
#define N 20 #define N 20
#define MAX_IMAGES 20 #define MAX_IMAGES 20
#define MAX_IMAGE_FILENAME 50 #define MAX_IMAGE_FILENAME 100
typedef struct area_stack_t { typedef struct area_stack_t {
int pos; int pos;
@ -95,13 +95,13 @@ enum {
static color_t palette[PAL_MAX]; static color_t palette[PAL_MAX];
void void
cairo_set_color (cairo_t *cr, const int i) cairo_set_color (cairo_t *cr, const int i)
{ {
cairo_set_source_rgba(cr, palette[i].r, palette[i].g, palette[i].b, palette[i].a); cairo_set_source_rgba(cr, palette[i].r, palette[i].g, palette[i].b, palette[i].a);
} }
void void
fill_rect (cairo_t *cr, const int i, int x, int y, int width, int height) fill_rect (cairo_t *cr, const int i, int x, int y, int width, int height)
{ {
cairo_set_color(cr, i); cairo_set_color(cr, i);
@ -110,7 +110,7 @@ fill_rect (cairo_t *cr, const int i, int x, int y, int width, int height)
cairo_fill(cr); cairo_fill(cr);
} }
void void
cairo_copy (cairo_t *cr, cairo_surface_t *s, int sx, int sy, int dx, int dy, int w, int h) cairo_copy (cairo_t *cr, cairo_surface_t *s, int sx, int sy, int dx, int dy, int w, int h)
{ {
cairo_set_source_surface(cr, s, dx - sx, dy - sy); cairo_set_source_surface(cr, s, dx - sx, dy - sy);
@ -118,7 +118,7 @@ cairo_copy (cairo_t *cr, cairo_surface_t *s, int sx, int sy, int dx, int dy, int
cairo_fill (cr); cairo_fill (cr);
} }
cairo_surface_t * cairo_surface_t *
load_image(char *filename) load_image(char *filename)
{ {
int i; int i;
@ -142,7 +142,7 @@ load_image(char *filename)
return imgs[i].data; return imgs[i].data;
} }
int int
draw_char (monitor_t *mon, int x, int align, char *ch, int draw_image) draw_char (monitor_t *mon, int x, int align, char *ch, int draw_image)
{ {
cairo_font_extents_t ext; cairo_font_extents_t ext;
@ -197,7 +197,7 @@ draw_char (monitor_t *mon, int x, int align, char *ch, int draw_image)
return ch_width; return ch_width;
} }
uint32_t uint32_t
parse_color (const char *str, char **end, const uint32_t def) parse_color (const char *str, char **end, const uint32_t def)
{ {
xcb_alloc_named_color_reply_t *nc_reply; xcb_alloc_named_color_reply_t *nc_reply;
@ -242,7 +242,7 @@ parse_color (const char *str, char **end, const uint32_t def)
return ret; return ret;
} }
void void
convert_color (const uint32_t col, color_t *out) convert_color (const uint32_t col, color_t *out)
{ {
out->b = ((col >> 0)&0xff) / 255.0; out->b = ((col >> 0)&0xff) / 255.0;
@ -252,7 +252,7 @@ convert_color (const uint32_t col, color_t *out)
out->a = 1.0; out->a = 1.0;
} }
void void
set_attribute (const char modifier, const char attribute) set_attribute (const char modifier, const char attribute)
{ {
int pos = indexof(attribute, "ou"); int pos = indexof(attribute, "ou");
@ -270,7 +270,7 @@ set_attribute (const char modifier, const char attribute)
} }
area_t * area_t *
area_get (xcb_window_t win, const int x) area_get (xcb_window_t win, const int x)
{ {
for (int i = 0; i < astack.pos; i++) for (int i = 0; i < astack.pos; i++)
@ -279,7 +279,7 @@ area_get (xcb_window_t win, const int x)
return NULL; return NULL;
} }
void void
area_shift (xcb_window_t win, const int align, int delta) area_shift (xcb_window_t win, const int align, int delta)
{ {
if (align == ALIGN_L) if (align == ALIGN_L)
@ -325,7 +325,7 @@ bool get_image_file(char *str, char *optend, char **end)
return true; return true;
} }
bool bool
area_add (char *str, const char *optend, char **end, monitor_t *mon, const int x, const int align, const int button) area_add (char *str, const char *optend, char **end, monitor_t *mon, const int x, const int align, const int button)
{ {
char *p = str; char *p = str;
@ -388,7 +388,7 @@ area_add (char *str, const char *optend, char **end, monitor_t *mon, const int x
return true; return true;
} }
void void
parse (char *text) parse (char *text)
{ {
monitor_t *cur_mon; monitor_t *cur_mon;
@ -479,7 +479,7 @@ parse (char *text)
} }
/* Eat the trailing } */ /* Eat the trailing } */
p++; p++;
} else { } else {
const int utf8_size[] = { const int utf8_size[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -501,8 +501,8 @@ parse (char *text)
pos_x += w; pos_x += w;
area_shift(cur_mon->window, align, w); area_shift(cur_mon->window, align, w);
} }
} }
} }
enum { enum {
@ -516,7 +516,7 @@ enum {
NET_WM_STATE_ABOVE, NET_WM_STATE_ABOVE,
}; };
void void
set_ewmh_atoms (void) set_ewmh_atoms (void)
{ {
const char *atom_names[] = { const char *atom_names[] = {
@ -569,7 +569,7 @@ set_ewmh_atoms (void)
} }
} }
monitor_t * monitor_t *
monitor_new (int x, int y, int width, int height) monitor_new (int x, int y, int width, int height)
{ {
monitor_t *ret; monitor_t *ret;
@ -605,7 +605,7 @@ monitor_new (int x, int y, int width, int height)
return ret; return ret;
} }
void void
monitor_add (monitor_t *mon) monitor_add (monitor_t *mon)
{ {
if (!monhead) { if (!monhead) {
@ -621,7 +621,7 @@ monitor_add (monitor_t *mon)
} }
} }
int int
rect_sort_cb (const void *p1, const void *p2) rect_sort_cb (const void *p1, const void *p2)
{ {
const xcb_rectangle_t *r1 = (xcb_rectangle_t *)p1; const xcb_rectangle_t *r1 = (xcb_rectangle_t *)p1;
@ -635,7 +635,7 @@ rect_sort_cb (const void *p1, const void *p2)
return 0; return 0;
} }
void void
monitor_create_chain (xcb_rectangle_t *rects, const int num) monitor_create_chain (xcb_rectangle_t *rects, const int num)
{ {
int i; int i;
@ -694,7 +694,7 @@ monitor_create_chain (xcb_rectangle_t *rects, const int num)
} }
} }
void void
get_randr_monitors (void) get_randr_monitors (void)
{ {
xcb_randr_get_screen_resources_current_reply_t *rres_reply; xcb_randr_get_screen_resources_current_reply_t *rres_reply;
@ -787,7 +787,7 @@ get_randr_monitors (void)
monitor_create_chain(r, valid); monitor_create_chain(r, valid);
} }
void void
get_xinerama_monitors (void) get_xinerama_monitors (void)
{ {
xcb_xinerama_query_screens_reply_t *xqs_reply; xcb_xinerama_query_screens_reply_t *xqs_reply;
@ -816,7 +816,7 @@ get_xinerama_monitors (void)
monitor_create_chain(rects, screens); monitor_create_chain(rects, screens);
} }
xcb_visualtype_t * xcb_visualtype_t *
get_visual_type (void) get_visual_type (void)
{ {
xcb_depth_iterator_t iter; xcb_depth_iterator_t iter;
@ -848,7 +848,7 @@ get_visual_type (void)
return NULL; return NULL;
} }
void void
xconn (void) xconn (void)
{ {
/* Connect to X */ /* Connect to X */
@ -868,7 +868,7 @@ xconn (void)
xcb_create_colormap(c, XCB_COLORMAP_ALLOC_NONE, colormap, scr->root, vt->visual_id); xcb_create_colormap(c, XCB_COLORMAP_ALLOC_NONE, colormap, scr->root, vt->visual_id);
} }
void void
init (void) init (void)
{ {
/* To make the alignment uniform */ /* To make the alignment uniform */
@ -934,7 +934,7 @@ init (void)
xcb_flush(c); xcb_flush(c);
} }
void void
cleanup (void) cleanup (void)
{ {
while (monhead) { while (monhead) {
@ -952,7 +952,7 @@ cleanup (void)
xcb_disconnect(c); xcb_disconnect(c);
} }
void void
sighandle (int signal) sighandle (int signal)
{ {
if (signal == SIGINT || signal == SIGTERM) if (signal == SIGINT || signal == SIGTERM)
@ -960,7 +960,7 @@ sighandle (int signal)
} }
/* Parse an X-styled geometry string, we don't support signed offsets tho. */ /* Parse an X-styled geometry string, we don't support signed offsets tho. */
bool bool
parse_geometry_string (char *str, int *tmp) parse_geometry_string (char *str, int *tmp)
{ {
char *p = str; char *p = str;
@ -1010,7 +1010,7 @@ parse_geometry_string (char *str, int *tmp)
return true; return true;
} }
void void
parse_font_list (char *str) parse_font_list (char *str)
{ {
char *tok; char *tok;
@ -1025,7 +1025,7 @@ parse_font_list (char *str)
return; return;
} }
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
struct pollfd pollin[2] = { struct pollfd pollin[2] = {