From owner-freebsd-current@FreeBSD.ORG Tue Sep 6 02:26:57 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 879D416A41F; Tue, 6 Sep 2005 02:26:57 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from rosebud.otenet.gr (rosebud.otenet.gr [195.170.0.94]) by mx1.FreeBSD.org (Postfix) with ESMTP id D1BC843D46; Tue, 6 Sep 2005 02:26:56 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from gothmog.gr (patr530-a079.otenet.gr [212.205.215.79]) by rosebud.otenet.gr (8.13.4/8.13.4/Debian-1) with ESMTP id j862QpPo002262; Tue, 6 Sep 2005 05:26:52 +0300 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.4/8.13.4) with ESMTP id j862QgBd000656; Tue, 6 Sep 2005 05:26:42 +0300 (EEST) (envelope-from keramida@freebsd.org) Received: (from giorgos@localhost) by gothmog.gr (8.13.4/8.13.4/Submit) id j862QaVl000630; Tue, 6 Sep 2005 05:26:36 +0300 (EEST) (envelope-from keramida@freebsd.org) Date: Tue, 6 Sep 2005 05:26:06 +0300 From: Giorgos Keramidas To: Slawa Olhovchenkov Message-ID: <20050906022606.GA607@gothmog.gr> References: <20050903133344.GA633@gothmog.gr> <20050905162713.GA92142@crodrigues.org> <20050905175826.GL69481@zxy.spb.ru> <20050906015418.GA590@gothmog.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050906015418.GA590@gothmog.gr> Cc: rodrigc@freebsd.org, Craig Rodrigues , freebsd-current@freebsd.org, mirya@matrix.kiev.ua Subject: Re: moused related panic X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2005 02:26:57 -0000 On 2005-09-06 04:54, Giorgos Keramidas 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); %%%