Re: [PATCH xrandr v2 1/2] xrandr: allow a single value for --scale
Hello, On Fri, Jul 14, 2017 at 2:46 AM, Aaron Plattner wrote: >> -.IP "\-\-scale \fIx\fPx\fIy\fP" >> -Changes the dimensions of the output picture. Values superior to 1 will >> lead to >> +.IP "\-\-scale \fIx\fP[x\fIy\fP]" >> +Changes the dimensions of the output picture. If the \fIy\fP value is >> omitted, >> +the \fIx\fP value will be used for both dimensions. Values superior to 1 >> will lead to > > > I think "greater than" or "larger than" are more common than "superior to" > for numerical comparisons, and new sentences in roff format are supposed to > start on their own lines. I can send a separate change to fix those if you > don't feel like fixing them as part of this change. No problem. I'll respin the series to get the whitespace right in this patch, and add a patch for the grammar fixes and newline-before-sentence (there's a few plurals in the rest of the paragraph that aren't very convincing either) >> if (sscanf (argv[i], "%lfx%lf", &sx, &sy) != 2) >> - argerr ("failed to parse '%s' as a scaling factor\n", >> argv[i]); >> + { >> + if (sscanf (argv[i], "%lf", &sx) != 1) > > > This looks like it's indented too far. Should be two tabs and no spaces, and > the next line should be two tabs and four spaces. Yes, this is terrible and > I hate it. ;) Let's see if I can get it right 8-) -- Giuseppe "Oblomov" Bilotta ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH xrandr v2 1/2] xrandr: allow a single value for --scale
On 06/22/2017 03:39 PM, Giuseppe Bilotta wrote: This allows using e.g. --scale 0.5 as a shorthand for --scale 0.5x0.5 Signed-off-by: Giuseppe Bilotta --- man/xrandr.man | 7 --- xrandr.c | 8 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/man/xrandr.man b/man/xrandr.man index 65ccc2a..e59abbe 100644 --- a/man/xrandr.man +++ b/man/xrandr.man @@ -34,7 +34,7 @@ xrandr \- primitive command line interface to RandR extension [\-\-current] [\-\-noprimary] [\-\-panning \fIwidth\fPx\fIheight\fP[+\fIx\fP+\fIy\fP[/\fItrack_width\fPx\fItrack_height\fP+\fItrack_x\fP+\fItrack_y\fP[/\fIborder_left\fP/\fIborder_top\fP/\fIborder_right\fP/\fIborder_bottom\fP -[\-\-scale \fIx\fPx\fIy\fP] +[\-\-scale \fIx\fP[x\fIy\fP]] [\-\-scale-from \fIw\fPx\fIh\fP] [\-\-transform \fIa\fP,\fIb\fP,\fIc\fP,\fId\fP,\fIe\fP,\fIf\fP,\fIg\fP,\fIh\fP,\fIi\fP] [\-\-primary] @@ -207,8 +207,9 @@ values are used (a unit matrix without filter). Chooses the scaling filter method to be applied when the screen is scaled or transformed. Can be either 'bilinear' or 'nearest'. -.IP "\-\-scale \fIx\fPx\fIy\fP" -Changes the dimensions of the output picture. Values superior to 1 will lead to +.IP "\-\-scale \fIx\fP[x\fIy\fP]" +Changes the dimensions of the output picture. If the \fIy\fP value is omitted, +the \fIx\fP value will be used for both dimensions. Values superior to 1 will lead to I think "greater than" or "larger than" are more common than "superior to" for numerical comparisons, and new sentences in roff format are supposed to start on their own lines. I can send a separate change to fix those if you don't feel like fixing them as part of this change. a compressed screen (screen dimension bigger than the dimension of the output mode), and values below 1 leads to a zoom in on the output. This option is actually a shortcut version of the \fI\-\-transform\fP option. diff --git a/xrandr.c b/xrandr.c index 2d4cb72..4433724 100644 --- a/xrandr.c +++ b/xrandr.c @@ -137,7 +137,7 @@ usage(void) " --below \n" " --same-as \n" " --set \n" - " --scale x\n" + " --scale [x]\n" " --scale-from x\n" " --transform \n" " --filter nearest,bilinear\n" @@ -3017,7 +3017,11 @@ main (int argc, char **argv) if (!config_output) argerr ("%s must be used after --output\n", argv[i]); if (++i >= argc) argerr ("%s requires an argument\n", argv[i-1]); if (sscanf (argv[i], "%lfx%lf", &sx, &sy) != 2) - argerr ("failed to parse '%s' as a scaling factor\n", argv[i]); + { + if (sscanf (argv[i], "%lf", &sx) != 1) This looks like it's indented too far. Should be two tabs and no spaces, and the next line should be two tabs and four spaces. Yes, this is terrible and I hate it. ;) Otherwise, this seems fine to me. + argerr ("failed to parse '%s' as a scaling factor\n", argv[i]); + sy = sx; + } init_transform (&config_output->transform); config_output->transform.transform.matrix[0][0] = XDoubleToFixed (sx); config_output->transform.transform.matrix[1][1] = XDoubleToFixed (sy); ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xrandr v2 1/2] xrandr: allow a single value for --scale
This allows using e.g. --scale 0.5 as a shorthand for --scale 0.5x0.5 Signed-off-by: Giuseppe Bilotta --- man/xrandr.man | 7 --- xrandr.c | 8 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/man/xrandr.man b/man/xrandr.man index 65ccc2a..e59abbe 100644 --- a/man/xrandr.man +++ b/man/xrandr.man @@ -34,7 +34,7 @@ xrandr \- primitive command line interface to RandR extension [\-\-current] [\-\-noprimary] [\-\-panning \fIwidth\fPx\fIheight\fP[+\fIx\fP+\fIy\fP[/\fItrack_width\fPx\fItrack_height\fP+\fItrack_x\fP+\fItrack_y\fP[/\fIborder_left\fP/\fIborder_top\fP/\fIborder_right\fP/\fIborder_bottom\fP -[\-\-scale \fIx\fPx\fIy\fP] +[\-\-scale \fIx\fP[x\fIy\fP]] [\-\-scale-from \fIw\fPx\fIh\fP] [\-\-transform \fIa\fP,\fIb\fP,\fIc\fP,\fId\fP,\fIe\fP,\fIf\fP,\fIg\fP,\fIh\fP,\fIi\fP] [\-\-primary] @@ -207,8 +207,9 @@ values are used (a unit matrix without filter). Chooses the scaling filter method to be applied when the screen is scaled or transformed. Can be either 'bilinear' or 'nearest'. -.IP "\-\-scale \fIx\fPx\fIy\fP" -Changes the dimensions of the output picture. Values superior to 1 will lead to +.IP "\-\-scale \fIx\fP[x\fIy\fP]" +Changes the dimensions of the output picture. If the \fIy\fP value is omitted, +the \fIx\fP value will be used for both dimensions. Values superior to 1 will lead to a compressed screen (screen dimension bigger than the dimension of the output mode), and values below 1 leads to a zoom in on the output. This option is actually a shortcut version of the \fI\-\-transform\fP option. diff --git a/xrandr.c b/xrandr.c index 2d4cb72..4433724 100644 --- a/xrandr.c +++ b/xrandr.c @@ -137,7 +137,7 @@ usage(void) " --below \n" " --same-as \n" " --set \n" - " --scale x\n" + " --scale [x]\n" " --scale-from x\n" " --transform \n" " --filter nearest,bilinear\n" @@ -3017,7 +3017,11 @@ main (int argc, char **argv) if (!config_output) argerr ("%s must be used after --output\n", argv[i]); if (++i >= argc) argerr ("%s requires an argument\n", argv[i-1]); if (sscanf (argv[i], "%lfx%lf", &sx, &sy) != 2) - argerr ("failed to parse '%s' as a scaling factor\n", argv[i]); + { + if (sscanf (argv[i], "%lf", &sx) != 1) + argerr ("failed to parse '%s' as a scaling factor\n", argv[i]); + sy = sx; + } init_transform (&config_output->transform); config_output->transform.transform.matrix[0][0] = XDoubleToFixed (sx); config_output->transform.transform.matrix[1][1] = XDoubleToFixed (sy); -- 2.13.0.rc0.207.gb442654931 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel