Date: Tue, 6 Sep 2005 05:26:06 +0300 From: Giorgos Keramidas <keramida@freebsd.org> To: Slawa Olhovchenkov <slw@zxy.spb.ru> Cc: rodrigc@freebsd.org, Craig Rodrigues <rodrigc@crodrigues.org>, freebsd-current@freebsd.org, mirya@matrix.kiev.ua Subject: Re: moused related panic Message-ID: <20050906022606.GA607@gothmog.gr> In-Reply-To: <20050906015418.GA590@gothmog.gr> References: <20050903133344.GA633@gothmog.gr> <20050905162713.GA92142@crodrigues.org> <20050905175826.GL69481@zxy.spb.ru> <20050906015418.GA590@gothmog.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-09-06 04:54, Giorgos Keramidas <keramida@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); %%%
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050906022606.GA607>