Draw: Replace statustext_image by parse_color_block, remove image stuff in status.c (draw_text image stuff is sufficient) and update version
This commit is contained in:
parent
09418c6dd7
commit
aa9609b5cf
@ -52,7 +52,7 @@ set(wmfs_src
|
|||||||
add_executable(wmfs ${wmfs_src})
|
add_executable(wmfs ${wmfs_src})
|
||||||
|
|
||||||
# Set the version
|
# Set the version
|
||||||
set(VERSION "WMFS-201002")
|
set(VERSION "WMFS-201003")
|
||||||
|
|
||||||
# FLAGS
|
# FLAGS
|
||||||
set(CFLAGS "-g -Wall -ansi")
|
set(CFLAGS "-g -Wall -ansi")
|
||||||
|
|||||||
@ -53,11 +53,11 @@ draw_text(Drawable d, int x, int y, char* fg, int pad, char *str)
|
|||||||
#ifdef HAVE_IMLIB
|
#ifdef HAVE_IMLIB
|
||||||
char *ostr = NULL;
|
char *ostr = NULL;
|
||||||
int i, ni;
|
int i, ni;
|
||||||
StatusImage im[56];
|
ImageAttr im[128];
|
||||||
|
|
||||||
ostr = _strdup(str);
|
ostr = _strdup(str);
|
||||||
|
|
||||||
ni = statustext_image(im, str);
|
ni = parse_image_block(im, str);
|
||||||
|
|
||||||
for(i = 0; i < ni; ++i)
|
for(i = 0; i < ni; ++i)
|
||||||
draw_image(d, im[i].x, im[i].y, im[i].w, im[i].h, im[i].name);
|
draw_image(d, im[i].x, im[i].y, im[i].w, im[i].h, im[i].name);
|
||||||
@ -161,11 +161,11 @@ textw(char *text)
|
|||||||
#ifdef HAVE_IMLIB
|
#ifdef HAVE_IMLIB
|
||||||
char *ostr = NULL;
|
char *ostr = NULL;
|
||||||
|
|
||||||
StatusImage im[56];
|
ImageAttr im[128];
|
||||||
|
|
||||||
ostr = _strdup(text);
|
ostr = _strdup(text);
|
||||||
|
|
||||||
statustext_image(im, text);
|
parse_image_block(im, text);
|
||||||
#endif /* HAVE_IMLIB */
|
#endif /* HAVE_IMLIB */
|
||||||
|
|
||||||
XftTextExtentsUtf8(dpy, font, (FcChar8 *)text, strlen(text), &gl);
|
XftTextExtentsUtf8(dpy, font, (FcChar8 *)text, strlen(text), &gl);
|
||||||
|
|||||||
17
src/status.c
17
src/status.c
@ -83,12 +83,12 @@ statustext_text(StatusText *s, char *str)
|
|||||||
#ifdef HAVE_IMLIB
|
#ifdef HAVE_IMLIB
|
||||||
/** Check images blocks in str and return properties
|
/** Check images blocks in str and return properties
|
||||||
* --> \i[x;y;w;h;name]\
|
* --> \i[x;y;w;h;name]\
|
||||||
*\param im StatusImage pointer, image properties
|
*\param im ImageAttr pointer, image properties
|
||||||
*\param str String
|
*\param str String
|
||||||
*\return n Lenght of i
|
*\return n Lenght of i
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
statustext_image(StatusImage *im, char *str)
|
statustext_image(ImageAttr *im, char *str)
|
||||||
{
|
{
|
||||||
char as;
|
char as;
|
||||||
int n, i, j, k;
|
int n, i, j, k;
|
||||||
@ -188,13 +188,6 @@ statustext_handle(int sc, char *str)
|
|||||||
nr = statustext_rectangle(r, str);
|
nr = statustext_rectangle(r, str);
|
||||||
ns = statustext_text(s, str);
|
ns = statustext_text(s, str);
|
||||||
|
|
||||||
#ifdef HAVE_IMLIB
|
|
||||||
int ni;
|
|
||||||
StatusImage im[128];
|
|
||||||
|
|
||||||
ni = statustext_image(im, str);
|
|
||||||
#endif /* HAVE_IMLIB */
|
|
||||||
|
|
||||||
/* Draw normal text (and possibly colored with \#color\ blocks) */
|
/* Draw normal text (and possibly colored with \#color\ blocks) */
|
||||||
statustext_normal(sc, str);
|
statustext_normal(sc, str);
|
||||||
|
|
||||||
@ -206,12 +199,6 @@ statustext_handle(int sc, char *str)
|
|||||||
for(i = 0; i < ns; ++i)
|
for(i = 0; i < ns; ++i)
|
||||||
draw_text(infobar[sc].bar->dr, s[i].x, s[i].y, s[i].color, 0, s[i].text);
|
draw_text(infobar[sc].bar->dr, s[i].x, s[i].y, s[i].color, 0, s[i].text);
|
||||||
|
|
||||||
#ifdef HAVE_IMLIB
|
|
||||||
/* Draw images with stored properties. */
|
|
||||||
for(i = 0; i < ni; ++i)
|
|
||||||
draw_image(infobar[sc].bar->dr, im[i].x, im[i].y, im[i].w, im[i].h, im[i].name);
|
|
||||||
#endif /* HAVE_IMLIB */
|
|
||||||
|
|
||||||
barwin_refresh(infobar[sc].bar);
|
barwin_refresh(infobar[sc].bar);
|
||||||
|
|
||||||
free(lastst);
|
free(lastst);
|
||||||
|
|||||||
@ -423,7 +423,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
uint x, y, w, h;
|
uint x, y, w, h;
|
||||||
char name[512];
|
char name[512];
|
||||||
} StatusImage;
|
} ImageAttr;
|
||||||
|
|
||||||
/* Config.c struct */
|
/* Config.c struct */
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|||||||
26
src/util.c
26
src/util.c
@ -264,3 +264,29 @@ uicb_spawn(uicb_t cmd)
|
|||||||
spawn("%s", cmd);
|
spawn("%s", cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_IMLIB
|
||||||
|
/** Check images blocks in str and return properties
|
||||||
|
* --> \i[x;y;w;h;name]\
|
||||||
|
*\param im ImageAttr pointer, image properties
|
||||||
|
*\param str String
|
||||||
|
*\return n Lenght of i
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
parse_image_block(ImageAttr *im, char *str)
|
||||||
|
{
|
||||||
|
char as;
|
||||||
|
int n, i, j, k;
|
||||||
|
|
||||||
|
for(i = j = n = 0; i < strlen(str); ++i, ++j)
|
||||||
|
if(sscanf(&str[i], "\\i[%d;%d;%d;%d;%512[^]]]%c", &im[n].x, &im[n].y, &im[n].w, &im[n].h, im[n].name, &as) == 6
|
||||||
|
&& as == '\\')
|
||||||
|
for(++n, ++i, --j; str[i] != as || str[i - 1] != ']'; ++i);
|
||||||
|
else if(j != i)
|
||||||
|
str[j] = str[i];
|
||||||
|
|
||||||
|
for(k = j; k < i; str[k++] = 0);
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_IMLIB */
|
||||||
|
|
||||||
|
|||||||
10
src/wmfs.h
10
src/wmfs.h
@ -273,6 +273,11 @@ void spawn(const char *str, ...);
|
|||||||
void swap_ptr(void **x, void **y);
|
void swap_ptr(void **x, void **y);
|
||||||
void uicb_spawn(uicb_t);
|
void uicb_spawn(uicb_t);
|
||||||
|
|
||||||
|
#ifdef HAVE_IMLIB
|
||||||
|
int parse_image_block(ImageAttr *im, char *str);
|
||||||
|
#endif /* HAVE_IMLIB */
|
||||||
|
|
||||||
|
|
||||||
/* tag.c */
|
/* tag.c */
|
||||||
void tag_set(int tag);
|
void tag_set(int tag);
|
||||||
void tag_transfert(Client *c, int tag);
|
void tag_transfert(Client *c, int tag);
|
||||||
@ -299,11 +304,6 @@ void uicb_screen_prev_sel(uicb_t);
|
|||||||
/* status.c */
|
/* status.c */
|
||||||
int statustext_rectangle(StatusRec *r, char *str);
|
int statustext_rectangle(StatusRec *r, char *str);
|
||||||
int statustext_text(StatusText *s, char *str);
|
int statustext_text(StatusText *s, char *str);
|
||||||
|
|
||||||
#ifdef HAVE_IMLIB
|
|
||||||
int statustext_image(StatusImage *im, char *str);
|
|
||||||
#endif /* HAVE_IMLIB */
|
|
||||||
|
|
||||||
void statustext_normal(int sc, char *str);
|
void statustext_normal(int sc, char *str);
|
||||||
void statustext_handle(int sc, char *str);
|
void statustext_handle(int sc, char *str);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user