moused related panic
Giorgos Keramidas
keramida at freebsd.org
Mon Sep 5 19:26:57 PDT 2005
On 2005-09-06 04:54, Giorgos Keramidas <keramida at freebsd.org> wrote:
> The following patch fixes the movement of the cursor in VESA text modes and
> avoids a panic in non-graphics VESA modes, by wrapping the graphics-specific
[...]
Wrong diff, sorry. This one leaves "mouse cursor trails", because it doesn't
solve the real problem and fails to calculate the correct mouse_pos. The
following should work much better, by assigning a default font_width of 8 to
VESA text modes that have a font_width of zero.
%%%
Index: scmouse.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/syscons/scmouse.c,v
retrieving revision 1.38
diff -u -r1.38 scmouse.c
--- scmouse.c 30 Aug 2005 18:58:16 -0000 1.38
+++ scmouse.c 6 Sep 2005 02:21:38 -0000
@@ -140,9 +140,14 @@
static void
set_mouse_pos(scr_stat *scp)
{
- if (scp->mouse_xpos < scp->xoff*scp->font_width)
- scp->mouse_xpos = scp->xoff*scp->font_width;
- if (scp->mouse_ypos < scp->yoff*scp->font_size)
+ int font_width;
+
+ KASSERT(scp != NULL, ("null scp"));
+
+ font_width = (scp->font_width ? scp->font_width : 8);
+ if (scp->mouse_xpos < scp->xoff * font_width)
+ scp->mouse_xpos = scp->xoff * font_width;
+ if (scp->mouse_ypos < scp->yoff * scp->font_size)
scp->mouse_ypos = scp->yoff*scp->font_size;
if (ISGRAPHSC(scp)) {
if (scp->mouse_xpos > scp->xpixel-1)
@@ -151,17 +156,17 @@
scp->mouse_ypos = scp->ypixel-1;
return;
} else {
- if (scp->mouse_xpos > (scp->xsize + scp->xoff)*scp->font_width - 1)
- scp->mouse_xpos = (scp->xsize + scp->xoff)*scp->font_width - 1;
- if (scp->mouse_ypos > (scp->ysize + scp->yoff)*scp->font_size - 1)
- scp->mouse_ypos = (scp->ysize + scp->yoff)*scp->font_size - 1;
+ if (scp->mouse_xpos > (scp->xsize + scp->xoff) * font_width - 1)
+ scp->mouse_xpos = (scp->xsize + scp->xoff) * font_width - 1;
+ if (scp->mouse_ypos > (scp->ysize + scp->yoff) * scp->font_size - 1)
+ scp->mouse_ypos = (scp->ysize + scp->yoff) * scp->font_size - 1;
}
if (scp->mouse_xpos != scp->mouse_oldxpos || scp->mouse_ypos != scp->mouse_oldypos) {
scp->status |= MOUSE_MOVED;
- scp->mouse_pos =
- (scp->mouse_ypos/scp->font_size - scp->yoff)*scp->xsize
- + scp->mouse_xpos/scp->font_width - scp->xoff;
+ scp->mouse_pos =
+ (scp->mouse_ypos / scp->font_size - scp->yoff) * scp->xsize +
+ scp->mouse_xpos / font_width - scp->xoff;
#ifndef SC_NO_CUTPASTE
if ((scp->status & MOUSE_VISIBLE) && (scp->status & MOUSE_CUTTING))
mouse_cut(scp);
%%%
More information about the freebsd-current
mailing list