Subject: wscons
To: None <netbsd-users@netbsd.org>
From: David Ferlier <krp@freeshell.org>
List: current-users
Date: 07/01/2002 11:21:46
Hi again. Sorry to have been so long, but i went through a serie of exams ;)

So, for the scrolling patch, i followed all suggestions.

First for the wscons commands : i defined four wskbd commands 

 - KS_Cmd_ScrollFastUp -> Scrolls up of the scroll.fastlines wsconsctl option
 - KS_Cmd_ScrollFastDown -> Scrolls down of the scroll.fastlines wsconsctl option
 - KS_Cmd_ScrollSlowUp -> Scrolls up of the scroll.slowlines wsconsctl option
 - KS_Cmd_ScrollSlowDown -> Scrolls down of the scroll.slowlines wsconsctl option

These commands are to define in your keyboard map, like :

keycode 200 = Cmd_ScrollSlowUp Up
keycode 201 = Cmd_ScrollFastUp Prior
keycode 208 = Cmd_ScrollSlowDown Down
keycode 209 = Cmd_ScrollFastDown Next

I added four options to wsconsctl :

Keyboard side

1) scroll.mode. If set to 0, you can scroll with Modifier + Commands (the Linux behavior). If set to 1, you can use the behavior of FreeBSD : You need to press HoldScreen, then use the Commands to scroll up / down.

2) scroll.modifier. This is a unsigned integer. Each bit of the integer codes for a modifier (see sys/dev/wscons/wskbd.c). For example, MOD_SHIFT_L = 1. If you want for example the modifier to be Ctrl_L + Alt_L, you need to or MOD_CONTROL_L (2^4) and MOD_META_L (2^6). 2^4 | 2^6 gives 80. Do wsconsctl -w scroll.modifier=80 and your modifier will be Alt+Control (both left). It is safer and much easier to maintain than a string passed to the kernel.


Display side (wsconsctl -d ...)

3) scroll.fastlines : controls how much lines will be scrolled up/down when Cmd_ScrollFastUp/Down commands are pressed.

4) scroll.slowlines : controls how much lines will be scrolled up/down when Cmd_ScrollSlowUp/Down commands are pressed.


Besides these options, it is clear that someone who wants to log in single-user mode won't know which key do what. First, the kernel option WSDISPLAY_SCROLLSUPPORT enables the scrolling support in the kernel. Then, WSDISPLAY_SCROLLCOMBO defines a serie of keystrokes (or one keystroke) that will define the modifier. You just need to or your values. For example, in my config i have now :

options         WSDISPLAY_SCROLLSUPPORT
options         WSDISPLAY_SCROLLCOMBO="(MOD_META_L | MOD_CONTROL_L)"

If WSDISPLAY_SCROLLCOMBO is not defined, MOD_SHIFT_L is assumed.

As you see, the modifier is know Alt_L + Control_L. As i said, these values are defined in sys/dev/wscons/wskbd.c

It becomes very easy for each port maintainer to set which keys activate the scroll (or they can directly disable it)

I think it would be interesting that some people who got poor cobaye boxes test the code.

Note: I sent-pr the code, and it is still at 

http://c0redump.skreel.org/netbsd/wsscroll.patch

Second Note: I know that the names i choosed for the ioctls and the commands are not perfect. They are the result of der Mouse 's suggestions ;-)

	David

-- 

Run NetBSD    - www.NetBSD.org
David Ferlier - krp@freeshell.org