make sure command is some text != ""
else call with command arg = NULL No need to check for a_strlen(command) then on _tell anymore if command != NULL
This commit is contained in:
parent
98e219fab8
commit
2e6dccc5ac
8
widget.c
8
widget.c
|
@ -217,10 +217,14 @@ uicb_widget_tell(int screen, char *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
property = p;
|
property = p;
|
||||||
|
p = p + a_strlen(p) + 1; /* could be out of 'arg' now */
|
||||||
|
|
||||||
if(p + a_strlen(p) < arg + len)
|
/* arg + len points to the finishing \0.
|
||||||
|
* p to the char right of the first space (strtok delimiter)
|
||||||
|
*
|
||||||
|
* \0 is on the right(>) of p pointer => some text (command) */
|
||||||
|
if(arg + len > p)
|
||||||
{
|
{
|
||||||
p = p + a_strlen(p) + 1;
|
|
||||||
len = a_strlen(p);
|
len = a_strlen(p);
|
||||||
command = p_new(char, len + 1);
|
command = p_new(char, len + 1);
|
||||||
a_strncpy(command, len + 1, p, len);
|
a_strncpy(command, len + 1, p, len);
|
||||||
|
|
|
@ -67,15 +67,15 @@ textbox_tell(Widget *widget, char *property, char *command)
|
||||||
Data *d = widget->data;
|
Data *d = widget->data;
|
||||||
XftFont *newfont;
|
XftFont *newfont;
|
||||||
|
|
||||||
if(!command)
|
|
||||||
return WIDGET_ERROR_NOVALUE;
|
|
||||||
|
|
||||||
if(!a_strcmp(property, "text"))
|
if(!a_strcmp(property, "text"))
|
||||||
{
|
{
|
||||||
if (d->text)
|
if (d->text)
|
||||||
p_delete(&d->text);
|
p_delete(&d->text);
|
||||||
d->text = a_strdup(command);
|
d->text = a_strdup(command);
|
||||||
}
|
}
|
||||||
|
/* !command means a not existing string. So return here */
|
||||||
|
else if(!command)
|
||||||
|
return WIDGET_ERROR_NOVALUE;
|
||||||
else if(!a_strcmp(property, "fg"))
|
else if(!a_strcmp(property, "fg"))
|
||||||
if(draw_color_new(globalconf.display, widget->statusbar->screen, command, &d->colors.fg))
|
if(draw_color_new(globalconf.display, widget->statusbar->screen, command, &d->colors.fg))
|
||||||
return WIDGET_NOERROR;
|
return WIDGET_NOERROR;
|
||||||
|
@ -88,9 +88,8 @@ textbox_tell(Widget *widget, char *property, char *command)
|
||||||
return WIDGET_ERROR_FORMAT_COLOR;
|
return WIDGET_ERROR_FORMAT_COLOR;
|
||||||
else if(!a_strcmp(property, "font"))
|
else if(!a_strcmp(property, "font"))
|
||||||
{
|
{
|
||||||
if(a_strlen(command)
|
if((newfont = XftFontOpenName(globalconf.display,
|
||||||
&& (newfont = XftFontOpenName(globalconf.display,
|
get_phys_screen(widget->statusbar->screen), command)))
|
||||||
get_phys_screen(widget->statusbar->screen), command)))
|
|
||||||
{
|
{
|
||||||
if(widget->font != globalconf.screens[widget->statusbar->screen].font)
|
if(widget->font != globalconf.screens[widget->statusbar->screen].font)
|
||||||
XftFontClose(globalconf.display, widget->font);
|
XftFontClose(globalconf.display, widget->font);
|
||||||
|
|
Loading…
Reference in New Issue