Skip to content

Commit

Permalink
Fix parsing of shadow-exclude-reg
Browse files Browse the repository at this point in the history
Closes #13

Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Oct 3, 2018
1 parent f1872c4 commit 9e1422d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ parse_geometry(session_t *ps, const char *src, region_t *dest) {
if (!ps->root_width || !ps->root_height)
return true;

geometry_t geom = { .wid = -1, .hei = -1, .x = -1, .y = -1 };
geometry_t geom = { .wid = ps->root_width, .hei = ps->root_height, .x = 0, .y = 0 };
long val = 0L;
char *endptr = NULL;

Expand All @@ -225,7 +225,8 @@ parse_geometry(session_t *ps, const char *src, region_t *dest) {
// Must be base 10, because "0x0..." may appear
if (!('+' == *src || '-' == *src)) {
val = strtol(src, &endptr, 10);
if (endptr && src != endptr) {
assert(endptr);
if (src != endptr) {
geom.wid = val;
if (geom.wid < 0) {
printf_errf("(\"%s\"): Invalid width.", src);
Expand All @@ -240,7 +241,8 @@ parse_geometry(session_t *ps, const char *src, region_t *dest) {
if ('x' == *src) {
++src;
val = strtol(src, &endptr, 10);
if (endptr && src != endptr) {
assert(endptr);
if (src != endptr) {
geom.hei = val;
if (geom.hei < 0) {
printf_errf("(\"%s\"): Invalid height.", src);
Expand Down

0 comments on commit 9e1422d

Please sign in to comment.