Fix parsing of shadow-exclude-reg
Closes #13 Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
f1872c4033
commit
9e1422dc90
|
@ -213,7 +213,7 @@ parse_geometry(session_t *ps, const char *src, region_t *dest) {
|
||||||
if (!ps->root_width || !ps->root_height)
|
if (!ps->root_width || !ps->root_height)
|
||||||
return true;
|
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;
|
long val = 0L;
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
|
|
||||||
|
@ -225,7 +225,8 @@ parse_geometry(session_t *ps, const char *src, region_t *dest) {
|
||||||
// Must be base 10, because "0x0..." may appear
|
// Must be base 10, because "0x0..." may appear
|
||||||
if (!('+' == *src || '-' == *src)) {
|
if (!('+' == *src || '-' == *src)) {
|
||||||
val = strtol(src, &endptr, 10);
|
val = strtol(src, &endptr, 10);
|
||||||
if (endptr && src != endptr) {
|
assert(endptr);
|
||||||
|
if (src != endptr) {
|
||||||
geom.wid = val;
|
geom.wid = val;
|
||||||
if (geom.wid < 0) {
|
if (geom.wid < 0) {
|
||||||
printf_errf("(\"%s\"): Invalid width.", src);
|
printf_errf("(\"%s\"): Invalid width.", src);
|
||||||
|
@ -240,7 +241,8 @@ parse_geometry(session_t *ps, const char *src, region_t *dest) {
|
||||||
if ('x' == *src) {
|
if ('x' == *src) {
|
||||||
++src;
|
++src;
|
||||||
val = strtol(src, &endptr, 10);
|
val = strtol(src, &endptr, 10);
|
||||||
if (endptr && src != endptr) {
|
assert(endptr);
|
||||||
|
if (src != endptr) {
|
||||||
geom.hei = val;
|
geom.hei = val;
|
||||||
if (geom.hei < 0) {
|
if (geom.hei < 0) {
|
||||||
printf_errf("(\"%s\"): Invalid height.", src);
|
printf_errf("(\"%s\"): Invalid height.", src);
|
||||||
|
|
Loading…
Reference in New Issue