From owner-svn-src-head@FreeBSD.ORG Thu Aug 21 14:54:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7813336D; Thu, 21 Aug 2014 14:54:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 630EF3F9C; Thu, 21 Aug 2014 14:54:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7LEscDx012507; Thu, 21 Aug 2014 14:54:38 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7LEsbIM012504; Thu, 21 Aug 2014 14:54:37 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201408211454.s7LEsbIM012504@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Thu, 21 Aug 2014 14:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270273 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Aug 2014 14:54:38 -0000 Author: dumbbell Date: Thu Aug 21 14:54:37 2014 New Revision: 270273 URL: http://svnweb.freebsd.org/changeset/base/270273 Log: vt(4): If the cursor didn't move, don't mark its position as dirty Currently, this has no effect, because the cursor is always redrawn anyway. But this will be useful after improvements to the vd_bitbltchr_t callback API. The vt_device structure members used to store the position of the cursor as of the last redraw are renamed from vd_mdirty{x,y} to vd_mold{x,y}. The associated comment is fixed too. Also, their value is now expressed in pixels, not in character columns/row. MFC after: 1 week Modified: head/sys/dev/vt/vt.h head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt.h ============================================================================== --- head/sys/dev/vt/vt.h Thu Aug 21 14:12:11 2014 (r270272) +++ head/sys/dev/vt/vt.h Thu Aug 21 14:54:37 2014 (r270273) @@ -122,10 +122,10 @@ struct vt_device { struct vt_window *vd_markedwin; /* (?) Copy/paste buf owner. */ const struct vt_driver *vd_driver; /* (c) Graphics driver. */ void *vd_softc; /* (u) Driver data. */ - uint16_t vd_mx; /* (?) Mouse X. */ - uint16_t vd_my; /* (?) Mouse Y. */ - vt_axis_t vd_mdirtyx; /* (?) Screen width. */ - vt_axis_t vd_mdirtyy; /* (?) Screen height. */ + uint16_t vd_mx; /* (?) Current mouse X. */ + uint16_t vd_my; /* (?) current mouse Y. */ + vt_axis_t vd_moldx; /* (?) Mouse X as of last redraw. */ + vt_axis_t vd_moldy; /* (?) Mouse Y as of last redraw. */ uint32_t vd_mstate; /* (?) Mouse state. */ term_pos_t vd_offset; /* (?) Pixel offset. */ vt_axis_t vd_width; /* (?) Screen width. */ Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Thu Aug 21 14:12:11 2014 (r270272) +++ head/sys/dev/vt/vt_core.c Thu Aug 21 14:54:37 2014 (r270273) @@ -835,9 +835,33 @@ vt_flush(struct vt_device *vd) #ifndef SC_NO_CUTPASTE if ((vd->vd_flags & VDF_MOUSECURSOR) && /* Mouse support enabled. */ !(vw->vw_flags & VWF_MOUSE_HIDE)) { /* Cursor displayed. */ - /* Mark last mouse position as dirty to erase. */ - vtbuf_mouse_cursor_position(&vw->vw_buf, vd->vd_mdirtyx, - vd->vd_mdirtyy); + if (vd->vd_moldx != vd->vd_mx || + vd->vd_moldy != vd->vd_my) { + /* + * Mark last mouse position as dirty to erase. + * + * FIXME: The font size could be different among + * all windows, so the column/row calculation + * below isn't correct for all windows. + * + * FIXME: The cursor can span more than one + * character cell. vtbuf_mouse_cursor_position + * marks surrounding cells as dirty. But due + * to font size possibly inconsistent across + * windows, this may not be sufficient. This + * causes part of the cursor to not be erased. + */ + vtbuf_mouse_cursor_position(&vw->vw_buf, + vd->vd_moldx / vf->vf_width, + vd->vd_moldy / vf->vf_height); + + /* + * Save point of last mouse cursor to erase it + * later. + */ + vd->vd_moldx = vd->vd_mx; + vd->vd_moldy = vd->vd_my; + } } #endif @@ -892,9 +916,6 @@ vt_flush(struct vt_device *vd) vd->vd_offset.tp_row + vd->vd_my, vd->vd_offset.tp_col + vd->vd_mx, w, h, TC_WHITE, TC_BLACK); - /* Save point of last mouse cursor to erase it later. */ - vd->vd_mdirtyx = vd->vd_mx / vf->vf_width; - vd->vd_mdirtyy = vd->vd_my / vf->vf_height; } #endif }