svn commit: r316642 - head/sys/dev/syscons

Bruce Evans brde at optusnet.com.au
Sun Apr 9 06:47:04 UTC 2017


On Sun, 9 Apr 2017, Andrey Chernov wrote:

> On 08.04.2017 13:00, Bruce Evans wrote:
>> Log:
>>   Quick fix for removal of the mouse cursor in vga direct graphics modes
>>   (that is, in all supported 8, 15, 16 and 24-color modes).  Moving the
>>   mouse cursor while holding down a button (giving cut marking) left a
>>   trail of garbage from misremoved mouse cursors (usually colored
>>   rectangles and not cursor shapes).  Cases with a button not held down
>>   worked better and may even have worked.
>>
>>   No renderer support for removing (software) mouse cursors is needed
>>   (and many renderers don't have any), since sc_remove_mouse_image()
>>   marks for update the region containing the image and usually much
>>   more.  The mouse cursor can be (partially) over as many as 4 character
>>   cells, and removing it in only the 1-4 cells occupied by it would be
>>   best for efficiency and for avoiding flicker.
>
> Please don't forget that this 5 cells range (0xd0-0xd4, last one becomes
> SC_CURSOR_CHAR) can be redefined with "vidcontrol -M", it is needed for
> the case they overlap valid characters region for some code tables.

I didn't forget it, but these cells are only used in text mode and there
are only 4 of them AFAIK (-M goes up to 252, which leaves space for only
4 cells 252-255).  Text mode is is one case that has no renderer support
for the mouse cursor.

Later I found that some renderer support is needed in all graphics modes
and would be needed in text mode too if it supported a reduced window
(say 79x24) so that the mouse cursor works better.  Normally the mouse
course is reduced to 1 dot if it is at the right or bottom border, but
in graphics modes there is sometimes extra space outside of the text
window.  E.g., in 800x600 mode, the default text window with an 8x16
font is 100x37 which occupies 800x592, so there is no extra space at
the right border and 8 pixels at the bottom border.  Users who wantt
to see the full mouse cursor at the borders should configure a 99x36
or just an 80x25 text window.  In text modes, there is no option to
reduce the text window.  So in graphics but not in text modes, the
mouse cursor renderer must have special support for erasing the mouse
outside of the text window, since other drawing methods top at the
border.

I don't understand SC_CURSOR_CHAR completely yet, but my cursor fixes
so far are mainly to prepare for improving the keyboard cursor.
SC_CURSOR_CHAR is normally statically configured as (0x07) SC_MOUSE_CHAR
as (0xd0) (both with bogus parentheses).  SC_CURSOR_CHAR is ifdefed
but is not a supported option.  SC_MOUSE_CHAR is a supported option.
NOTES gives the example of setting it to 0x3.  Then if the configured
SC_CURSOR_CHAR is inside the 4-char range for the mouse cursor, then
SC_CURSOR_CHAR is moved to (SC_MOUSE_CHAR + 4), although this is even
more broken if the mouse range is 252-255 and the cursor char is in
this range -- then the cursor char ends up as the invalid char 256.
Reconfiguring the mouse char range using -M causes similar problems.
There is no way to reconfigure the cursor char AFAIK.  In fact, it
doesn't even seem to be configured -- SC_CURSOR_CHAR is never used,
so I think sc->cursor_char is only statically initialized to 0.  This
is a smaller bug with scteken.  Teken breaks support for printing
character 0 (which is normally blank in syscons' fonts), so this font
position for this character is always available for use as the cursor
character.

I tested using the cursor char a little.  I normally use a non-blinking
normal keyboard cursor and see only negative advantages for the cursor
character.  But it would be useful to switch the cursor character(s)
or attributes occasionally to highlight the cursor by blinking it once
or twice, as is done using ripples for mouse cursors in some systems.
Changing the charcter is more interesting than blinking, and needed
more if there are only 2 colors.

The "normal" keyboard cursor should be the character under the cursor with
its bg modified to a unique color.  This only happens in some cases now.
Text mode usually works right, except the preferred unique color is
hard-coded as white and when the fg or bg or the current char is also
white, reverse video is used instead.  Other modes mostly use reverse video.
Reverse video is worse than usual when it is done more than once.  Cur
marking also gives reverse video.  The sc cursor over cut marking is
reversed again, making it look strange.  The vt cursor over cut marking
is not reversed again, making it invisible.  The mouse cursor mostly
works better by being destructive.

Bruce


More information about the svn-src-head mailing list