On Mon, Mar 18, 2019 at 06:30:15PM +0100, Frederic Cambus wrote:
> On Mon, Jan 07, 2019 at 04:27:46PM -0700, Theo de Raadt wrote:
> > Ted Unangst <[email protected]> wrote:
> >
> > > Artturi Alm wrote:
> > > > display.width=1920
> > > > display.height=1200
> > > > display.depth=32
> > > > display.emulations=vt100
> > > > display.col_x_row=120x37
> > > > display.font_wxh=16x32
> > >
> > > now that we've all had a chance to weigh in on the font, why are you
> > > adding
> > > this weird x format? speaking of ugly... it should print columns and rows
> > > just
> > > like width and height.
> >
> > it is a waste of kernel and userland code since another mechanism already
> > exists
> >
> > use stty -a
>
> While I agree it doesn't make sense to add variables for showing
> the number of columns and rows, as the information can be obtained
> using ssty -a, displaying fontwidth and fontheight values would be
> useful. This allows users to know the size of the currently loaded
> font.
>
> Thinking forward, this would also allow to easily get those values
> in shell scripts, which can be leveraged if we wanted to only embed
> 7-bit ASCII characters in the kernel and load the full font later on,
> or if someone wanted to continue the UTF-8 work [1] started by miod@.
>
> Revised diff below iterating on what Artturi previously sent, and
> a snippet of wsconsctl output with the diff applied:
>
> display.width=1600
> display.height=900
> display.depth=32
> +display.fontwidth=12
> +display.fontheight=24
> display.emulations=vt100
> display.screentypes=std
> display.focus=4
>
> [1] https://undeadly.org/cgi?action=article&sid=20131023125815
>
> Comments? OK?
>
While my opinion is irrelevant, it does look good to me, thanks :]
-Artturi
> Index: sbin/wsconsctl/display.c
> ===================================================================
> RCS file: /cvs/src/sbin/wsconsctl/display.c,v
> retrieving revision 1.20
> diff -u -p -r1.20 display.c
> --- sbin/wsconsctl/display.c 8 May 2015 19:12:51 -0000 1.20
> +++ sbin/wsconsctl/display.c 18 Mar 2019 17:11:59 -0000
> @@ -41,7 +41,7 @@
> #include "wsconsctl.h"
>
> u_int dpytype;
> -u_int width, height, depth;
> +u_int width, height, depth, fontwidth, fontheight;
> int focus;
> struct field_pc brightness, contrast, backlight;
> int burnon, burnoff, vblank, kbdact, msact, outact;
> @@ -54,6 +54,8 @@ struct field display_field_tab[] = {
> { "width", &width, FMT_UINT, FLG_RDONLY },
> { "height", &height, FMT_UINT, FLG_RDONLY },
> { "depth", &depth, FMT_UINT, FLG_RDONLY },
> + { "fontwidth", &fontwidth, FMT_UINT, FLG_RDONLY },
> + { "fontheight", &fontheight, FMT_UINT, FLG_RDONLY },
> { "emulations", &emuls, FMT_EMUL, FLG_RDONLY },
> { "screentypes", &screens, FMT_SCREEN, FLG_RDONLY },
> { "focus", &focus, FMT_INT, FLG_NORDBACK },
> @@ -84,7 +86,7 @@ display_get_values(int fd)
> const char *cmd_str;
> void *ptr;
> unsigned long cmd;
> - int bon = 0, fbon = 0;
> + int bon = 0, fbon = 0, son = 0;
>
> focus = gscr.idx = -1;
> for (pf = display_field_tab; pf->name; pf++) {
> @@ -102,6 +104,10 @@ display_get_values(int fd)
> } else if (ptr == &emuls) {
> fillioctl(WSDISPLAYIO_GETEMULTYPE);
> emuls.idx=0;
> + } else if (ptr == &fontwidth || ptr == &fontheight) {
> + fillioctl(WSDISPLAYIO_GETSCREENTYPE);
> + ptr = &screens;
> + screens.idx = 0;
> } else if (ptr == &screens) {
> fillioctl(WSDISPLAYIO_GETSCREENTYPE);
> screens.idx=0;
> @@ -168,6 +174,11 @@ display_get_values(int fd)
> emuls.idx=fd;
> } else if (ptr == &screens) {
> screens.idx=fd;
> + if (!son) {
> + fontwidth = screens.fontwidth;
> + fontheight = screens.fontheight;
> + }
> + son++;
> } else if (ptr == ¶m) {
> struct field_pc *pc = pf->valp;
>