mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-27 20:44:56 +00:00
tests for issue 236
This commit is contained in:
parent
d06649ec52
commit
bea6a5cb9b
15
src/conky.cc
15
src/conky.cc
@ -1015,6 +1015,16 @@ static int draw_mode; /* FG, BG or OUTLINE */
|
|||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
static long current_color;
|
static long current_color;
|
||||||
|
|
||||||
|
static int saved_coordinates_x[100];
|
||||||
|
static int saved_coordinates_y[100];
|
||||||
|
|
||||||
|
int get_saved_coordinates_x(int i) {
|
||||||
|
return saved_coordinates_x[i];
|
||||||
|
}
|
||||||
|
int get_saved_coordinates_y(int i) {
|
||||||
|
return saved_coordinates_y[i];
|
||||||
|
}
|
||||||
|
|
||||||
static int text_size_updater(char *s, int special_index) {
|
static int text_size_updater(char *s, int special_index) {
|
||||||
int w = 0;
|
int w = 0;
|
||||||
char *p;
|
char *p;
|
||||||
@ -1597,6 +1607,11 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) {
|
|||||||
cur_y += current->arg;
|
cur_y += current->arg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SAVE_COORDINATES:
|
||||||
|
saved_coordinates_x[static_cast<int>(current->arg)] = cur_x - text_start_x;
|
||||||
|
saved_coordinates_y[static_cast<int>(current->arg)] = cur_y + text_start_y - last_font_height;
|
||||||
|
break;
|
||||||
|
|
||||||
case TAB: {
|
case TAB: {
|
||||||
int start = current->arg;
|
int start = current->arg;
|
||||||
int step = current->width;
|
int step = current->width;
|
||||||
|
@ -301,6 +301,9 @@ void set_updatereset(int);
|
|||||||
int get_updatereset(void);
|
int get_updatereset(void);
|
||||||
int get_total_updates(void);
|
int get_total_updates(void);
|
||||||
|
|
||||||
|
int get_saved_coordinates_x(int);
|
||||||
|
int get_saved_coordinates_y(int);
|
||||||
|
|
||||||
/* defined in conky.c */
|
/* defined in conky.c */
|
||||||
int spaced_print(char *, int, const char *, int, ...)
|
int spaced_print(char *, int, const char *, int, ...)
|
||||||
__attribute__((format(printf, 3, 5)));
|
__attribute__((format(printf, 3, 5)));
|
||||||
|
@ -1011,6 +1011,8 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
|||||||
obj->callbacks.print = &new_offset;
|
obj->callbacks.print = &new_offset;
|
||||||
END OBJ(voffset, nullptr) obj->data.l = arg != nullptr ? atoi(arg) : 1;
|
END OBJ(voffset, nullptr) obj->data.l = arg != nullptr ? atoi(arg) : 1;
|
||||||
obj->callbacks.print = &new_voffset;
|
obj->callbacks.print = &new_voffset;
|
||||||
|
END OBJ(save_coordinates, nullptr) obj->data.l = arg != nullptr ? atoi(arg) : 0;
|
||||||
|
obj->callbacks.print = &new_save_coordinates;
|
||||||
END OBJ_ARG(goto, nullptr, "goto needs arguments") obj->data.l = atoi(arg);
|
END OBJ_ARG(goto, nullptr, "goto needs arguments") obj->data.l = atoi(arg);
|
||||||
obj->callbacks.print = &new_goto;
|
obj->callbacks.print = &new_goto;
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
|
@ -148,6 +148,15 @@ void cimlib_add_image(const char *args) {
|
|||||||
tmp += 3;
|
tmp += 3;
|
||||||
if (sscanf(tmp, "%d", &cur->flush_interval) != 0) { cur->no_cache = 0; }
|
if (sscanf(tmp, "%d", &cur->flush_interval) != 0) { cur->no_cache = 0; }
|
||||||
}
|
}
|
||||||
|
tmp = strstr(args, "-i ");
|
||||||
|
if (tmp != nullptr) {
|
||||||
|
tmp += 3;
|
||||||
|
int i;
|
||||||
|
if (sscanf(tmp, "%d", &i) == 1) {
|
||||||
|
cur->x = get_saved_coordinates_x(i);
|
||||||
|
cur->y = get_saved_coordinates_y(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (cur->flush_interval < 0) {
|
if (cur->flush_interval < 0) {
|
||||||
NORM_ERR("Imlib2: flush interval should be >= 0");
|
NORM_ERR("Imlib2: flush interval should be >= 0");
|
||||||
cur->flush_interval = 0;
|
cur->flush_interval = 0;
|
||||||
|
@ -310,6 +310,7 @@ const char *translate_nvidia_special_type[] = {
|
|||||||
"nvidiagraph", // GRAPH
|
"nvidiagraph", // GRAPH
|
||||||
"", // OFFSET
|
"", // OFFSET
|
||||||
"", // VOFFSET
|
"", // VOFFSET
|
||||||
|
"", // SAVE_COORDINATES
|
||||||
"", // FONT
|
"", // FONT
|
||||||
"", // GOTO
|
"", // GOTO
|
||||||
"" // TAB
|
"" // TAB
|
||||||
|
@ -749,6 +749,11 @@ void new_voffset(struct text_object *obj, char *p, unsigned int p_max_size) {
|
|||||||
new_special(p, VOFFSET)->arg = obj->data.l;
|
new_special(p, VOFFSET)->arg = obj->data.l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void new_save_coordinates(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
|
if (p_max_size == 0) { return; }
|
||||||
|
new_special(p, SAVE_COORDINATES)->arg = obj->data.l;
|
||||||
|
}
|
||||||
|
|
||||||
void new_alignr(struct text_object *obj, char *p, unsigned int p_max_size) {
|
void new_alignr(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
if (p_max_size == 0) { return; }
|
if (p_max_size == 0) { return; }
|
||||||
new_special(p, ALIGNR)->arg = obj->data.l;
|
new_special(p, ALIGNR)->arg = obj->data.l;
|
||||||
|
@ -51,6 +51,7 @@ enum special_types {
|
|||||||
GRAPH,
|
GRAPH,
|
||||||
OFFSET,
|
OFFSET,
|
||||||
VOFFSET,
|
VOFFSET,
|
||||||
|
SAVE_COORDINATES,
|
||||||
FONT,
|
FONT,
|
||||||
GOTO,
|
GOTO,
|
||||||
TAB
|
TAB
|
||||||
@ -105,6 +106,7 @@ void new_bg(struct text_object *, char *, unsigned int);
|
|||||||
void new_outline(struct text_object *, char *, unsigned int);
|
void new_outline(struct text_object *, char *, unsigned int);
|
||||||
void new_offset(struct text_object *, char *, unsigned int);
|
void new_offset(struct text_object *, char *, unsigned int);
|
||||||
void new_voffset(struct text_object *, char *, unsigned int);
|
void new_voffset(struct text_object *, char *, unsigned int);
|
||||||
|
void new_save_coordinates(struct text_object *, char *, unsigned int);
|
||||||
void new_alignr(struct text_object *, char *, unsigned int);
|
void new_alignr(struct text_object *, char *, unsigned int);
|
||||||
void new_alignc(struct text_object *, char *, unsigned int);
|
void new_alignc(struct text_object *, char *, unsigned int);
|
||||||
void new_goto(struct text_object *, char *, unsigned int);
|
void new_goto(struct text_object *, char *, unsigned int);
|
||||||
|
Loading…
Reference in New Issue
Block a user