mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-15 09:44:04 +00:00
Warn at wrong alignment setting and make sure it's disabled when the windowtype is dock
This commit is contained in:
parent
6526b47b2c
commit
656177e0de
45
src/conky.c
45
src/conky.c
@ -320,7 +320,8 @@ static int text_width, text_height;
|
|||||||
|
|
||||||
/* alignments */
|
/* alignments */
|
||||||
enum alignment {
|
enum alignment {
|
||||||
TOP_LEFT = 1,
|
ALIGNMENT_ERROR,
|
||||||
|
TOP_LEFT,
|
||||||
TOP_RIGHT,
|
TOP_RIGHT,
|
||||||
TOP_MIDDLE,
|
TOP_MIDDLE,
|
||||||
BOTTOM_LEFT,
|
BOTTOM_LEFT,
|
||||||
@ -4153,7 +4154,7 @@ static enum alignment string_to_alignment(const char *s)
|
|||||||
} else if (strcasecmp(s, "none") == EQUAL) {
|
} else if (strcasecmp(s, "none") == EQUAL) {
|
||||||
return NONE;
|
return NONE;
|
||||||
}
|
}
|
||||||
return TOP_LEFT;
|
return ALIGNMENT_ERROR;
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
|
|
||||||
@ -4506,6 +4507,27 @@ static int do_config_step(int *line, FILE *fp, char *buf, char **name, char **va
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setalignment(int* text_alignment, unsigned int windowtype, const char* value, const char *f, int line, char setbyconffile) {
|
||||||
|
#ifdef OWN_WINDOW
|
||||||
|
if (windowtype == TYPE_DOCK) {
|
||||||
|
NORM_ERR("alignment is disabled when own_window_type is dock");
|
||||||
|
} else
|
||||||
|
#endif /*OWN_WINDOW */
|
||||||
|
if (value) {
|
||||||
|
int a = string_to_alignment(value);
|
||||||
|
|
||||||
|
if (a <= 0) {
|
||||||
|
if(setbyconffile == true) {
|
||||||
|
CONF_ERR;
|
||||||
|
} else NORM_ERR("'%s' is not a alignment setting", value);
|
||||||
|
} else {
|
||||||
|
*text_alignment = a;
|
||||||
|
}
|
||||||
|
} else if(setbyconffile == true) {
|
||||||
|
CONF_ERR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char load_config_file(const char *f)
|
char load_config_file(const char *f)
|
||||||
{
|
{
|
||||||
int line = 0;
|
int line = 0;
|
||||||
@ -4549,22 +4571,7 @@ char load_config_file(const char *f)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
CONF("alignment") {
|
CONF("alignment") {
|
||||||
#ifdef OWN_WINDOW
|
setalignment(&text_alignment, window.type, value, f, line, true);
|
||||||
if (window.type == TYPE_DOCK)
|
|
||||||
;
|
|
||||||
else
|
|
||||||
#endif /*OWN_WINDOW */
|
|
||||||
if (value) {
|
|
||||||
int a = string_to_alignment(value);
|
|
||||||
|
|
||||||
if (a <= 0) {
|
|
||||||
CONF_ERR;
|
|
||||||
} else {
|
|
||||||
text_alignment = a;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
CONF_ERR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
CONF("background") {
|
CONF("background") {
|
||||||
fork_to_background = string_to_bool(value);
|
fork_to_background = string_to_bool(value);
|
||||||
@ -5637,7 +5644,7 @@ void initialisation(int argc, char **argv) {
|
|||||||
set_first_font(optarg);
|
set_first_font(optarg);
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
text_alignment = string_to_alignment(optarg);
|
setalignment(&text_alignment, window.type, optarg, NULL, 0, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
|
Loading…
Reference in New Issue
Block a user