0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

options: allow things like --geometry=x50

Although the use is somewhat questionable, it seems strange that e.g.
--geometry=50% works (and sets the width only), but setting the height
only in a similar manner does not work.
This commit is contained in:
wm4 2015-02-04 23:15:14 +01:00
parent 868d0f1e83
commit 9248f75853

View File

@ -1801,7 +1801,7 @@ static bool parse_geometry_str(struct m_geometry *gm, bstr s)
if (s.len == 0)
return true;
// Approximate grammar:
// [W[xH]][{+-}X{+-}Y] | [X:Y]
// [[W][xH]][{+-}X{+-}Y] | [X:Y]
// (meaning: [optional] {one character of} one|alternative)
// Every number can be followed by '%'
int num;
@ -1825,7 +1825,8 @@ static bool parse_geometry_str(struct m_geometry *gm, bstr s)
if (bstrchr(s, ':') < 0) {
gm->wh_valid = true;
if (!bstr_startswith0(s, "+") && !bstr_startswith0(s, "-")) {
READ_NUM(w, w_per);
if (!bstr_startswith0(s, "x"))
READ_NUM(w, w_per);
if (bstr_eatstart0(&s, "x"))
READ_NUM(h, h_per);
}