Re: moused related panic

From: Giorgos Keramidas <keramida_at_freebsd.org>
Date: Tue, 6 Sep 2005 05:26:06 +0300
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
_at__at_ -140,9 +140,14 _at__at_
 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)
_at__at_ -151,17 +156,17 _at__at_
 	    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);
%%%
Received on Tue Sep 06 2005 - 00:26:57 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:42 UTC