Implements same check for offsets, moves offset adding to seperate

function
This commit is contained in:
krypt-n 2015-06-02 09:38:31 +02:00
parent 61ffd9e35e
commit 088ddb6b51

View File

@ -765,6 +765,22 @@ font_load (const char *pattern)
font_list[font_count++] = ret; font_list[font_count++] = ret;
} }
void add_y_offset(int offset) {
if (offset_y_count >= MAX_FONT_COUNT) {
fprintf(stderr, "Max offset count reached. Could not set offset \"%d\"\n", offset);
return;
}
offsets_y[offset_y_count] = strtol(optarg, NULL, 10);
if (offset_y_count == 0) {
for (int i = 1; i < MAX_FONT_COUNT; ++i) {
offsets_y[i] = offsets_y[0];
}
}
++offset_y_count;
}
enum { enum {
NET_WM_WINDOW_TYPE, NET_WM_WINDOW_TYPE,
NET_WM_WINDOW_TYPE_DOCK, NET_WM_WINDOW_TYPE_DOCK,
@ -1371,14 +1387,7 @@ main (int argc, char **argv)
case 'd': dock = true; break; case 'd': dock = true; break;
case 'f': font_load(optarg); break; case 'f': font_load(optarg); break;
case 'u': bu = strtoul(optarg, NULL, 10); break; case 'u': bu = strtoul(optarg, NULL, 10); break;
case 'o': offsets_y[offset_y_count] = strtol(optarg, NULL, 10); case 'o': add_y_offset(strtol(optarg, NULL, 10)); break;
if (offset_y_count == 0) {
for (int i = 1; i < MAX_FONT_COUNT; ++i) {
offsets_y[i] = offsets_y[0];
}
}
++offset_y_count;
break;
case 'B': dbgc = bgc = parse_color(optarg, NULL, (rgba_t)scr->black_pixel); break; case 'B': dbgc = bgc = parse_color(optarg, NULL, (rgba_t)scr->black_pixel); break;
case 'F': dfgc = fgc = parse_color(optarg, NULL, (rgba_t)scr->white_pixel); break; case 'F': dfgc = fgc = parse_color(optarg, NULL, (rgba_t)scr->white_pixel); break;
} }