version 1.39, 2019/10/15 08:25:37 |
version 1.40, 2020/03/21 13:16:15 |
|
|
struct window *w = wl->window; |
struct window *w = wl->window; |
struct client *c = item->client; |
struct client *c = item->client; |
struct session *s = item->target.s; |
struct session *s = item->target.s; |
const char *errstr, *p; |
const char *errstr; |
char *cause, *copy; |
char *cause; |
u_int adjust; |
u_int adjust; |
int x, y, percentage; |
int x, y; |
size_t plen; |
|
|
|
if (args_has(args, 'M')) { |
if (args_has(args, 'M')) { |
if (cmd_mouse_window(&shared->mouse, &s) == NULL) |
if (cmd_mouse_window(&shared->mouse, &s) == NULL) |
|
|
} |
} |
} |
} |
|
|
if ((p = args_get(args, 'x')) != NULL) { |
if (args_has(args, 'x')) { |
plen = strlen(p); |
x = args_percentage(args, 'x', 0, INT_MAX, w->sx, &cause); |
if (p[plen - 1] == '%') { |
if (cause != NULL) { |
copy = xstrdup(p); |
cmdq_error(item, "width %s", cause); |
copy[plen - 1] = '\0'; |
free(cause); |
percentage = strtonum(copy, 0, INT_MAX, &errstr); |
return (CMD_RETURN_ERROR); |
free(copy); |
|
if (errstr != NULL) { |
|
cmdq_error(item, "width %s", errstr); |
|
return (CMD_RETURN_ERROR); |
|
} |
|
x = (w->sx * percentage) / 100; |
|
if (x < PANE_MINIMUM) |
|
x = PANE_MINIMUM; |
|
if (x > INT_MAX) |
|
x = INT_MAX; |
|
} else { |
|
x = args_strtonum(args, 'x', PANE_MINIMUM, INT_MAX, |
|
&cause); |
|
if (cause != NULL) { |
|
cmdq_error(item, "width %s", cause); |
|
free(cause); |
|
return (CMD_RETURN_ERROR); |
|
} |
|
} |
} |
layout_resize_pane_to(wp, LAYOUT_LEFTRIGHT, x); |
layout_resize_pane_to(wp, LAYOUT_LEFTRIGHT, x); |
} |
} |
if ((p = args_get(args, 'y')) != NULL) { |
if (args_has(args, 'y')) { |
plen = strlen(p); |
y = args_percentage(args, 'y', 0, INT_MAX, w->sy, &cause); |
if (p[plen - 1] == '%') { |
if (cause != NULL) { |
copy = xstrdup(p); |
cmdq_error(item, "width %s", cause); |
copy[plen - 1] = '\0'; |
free(cause); |
percentage = strtonum(copy, 0, INT_MAX, &errstr); |
return (CMD_RETURN_ERROR); |
free(copy); |
|
if (errstr != NULL) { |
|
cmdq_error(item, "height %s", errstr); |
|
return (CMD_RETURN_ERROR); |
|
} |
|
y = (w->sy * percentage) / 100; |
|
if (y < PANE_MINIMUM) |
|
y = PANE_MINIMUM; |
|
if (y > INT_MAX) |
|
y = INT_MAX; |
|
} |
|
else { |
|
y = args_strtonum(args, 'y', PANE_MINIMUM, INT_MAX, |
|
&cause); |
|
if (cause != NULL) { |
|
cmdq_error(item, "height %s", cause); |
|
free(cause); |
|
return (CMD_RETURN_ERROR); |
|
} |
|
} |
} |
layout_resize_pane_to(wp, LAYOUT_TOPBOTTOM, y); |
layout_resize_pane_to(wp, LAYOUT_TOPBOTTOM, y); |
} |
} |