From owner-svn-src-head@FreeBSD.ORG Thu Aug 21 19:15:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2C393332; Thu, 21 Aug 2014 19:15:23 +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 F1DAF3BAE; Thu, 21 Aug 2014 19:15:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7LJFM4F035096; Thu, 21 Aug 2014 19:15:22 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7LJFMTr035095; Thu, 21 Aug 2014 19:15:22 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201408211915.s7LJFMTr035095@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 19:15:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270290 - 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 19:15:23 -0000 Author: dumbbell Date: Thu Aug 21 19:15:22 2014 New Revision: 270290 URL: http://svnweb.freebsd.org/changeset/base/270290 Log: vt(4): Test if the cursor is shown only once Later, we just see if the "struct mouse_cursor" pointer is set. This avoids the need to mess with all the conditions several times; this has been error prone. While here, rename the variable "m" to a more meaningful "cursor", like it's done elsewhere in the code. MFC after: 1 week Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Thu Aug 21 19:04:15 2014 (r270289) +++ head/sys/dev/vt/vt_core.c Thu Aug 21 19:15:22 2014 (r270290) @@ -853,7 +853,7 @@ vt_flush(struct vt_device *vd) term_pos_t size; term_char_t *r; #ifndef SC_NO_CUTPASTE - struct mouse_cursor *m; + struct mouse_cursor *cursor; int bpl, h, w; #endif @@ -868,6 +868,7 @@ vt_flush(struct vt_device *vd) return; #ifndef SC_NO_CUTPASTE + cursor = NULL; if ((vd->vd_flags & VDF_MOUSECURSOR) && /* Mouse support enabled. */ !(vw->vw_flags & VWF_MOUSE_HIDE)) { /* Cursor displayed. */ if (vd->vd_moldx != vd->vd_mx || @@ -903,6 +904,11 @@ vt_flush(struct vt_device *vd) vd->vd_moldx = vd->vd_mx; vd->vd_moldy = vd->vd_my; } + + if (!kdb_active && panicstr == NULL) { + /* Mouse enabled, and DDB isn't active. */ + cursor = &vt_default_mouse_pointer; + } } #endif @@ -933,27 +939,17 @@ vt_flush(struct vt_device *vd) } #ifndef SC_NO_CUTPASTE - /* Mouse disabled. */ - if (vw->vw_flags & VWF_MOUSE_HIDE) - return; - - /* No mouse for DDB. */ - if (kdb_active || panicstr != NULL) - return; - - if ((vd->vd_flags & (VDF_MOUSECURSOR|VDF_TEXTMODE)) == - VDF_MOUSECURSOR) { - m = &vt_default_mouse_pointer; - bpl = (m->w + 7) >> 3; /* Bytes per source line. */ - w = m->w; - h = m->h; + if (cursor != NULL) { + bpl = (cursor->w + 7) >> 3; /* Bytes per source line. */ + w = cursor->w; + h = cursor->h; - if ((vd->vd_mx + m->w) > (size.tp_col * vf->vf_width)) + if ((vd->vd_mx + cursor->w) > (size.tp_col * vf->vf_width)) w = (size.tp_col * vf->vf_width) - vd->vd_mx - 1; - if ((vd->vd_my + m->h) > (size.tp_row * vf->vf_height)) + if ((vd->vd_my + cursor->h) > (size.tp_row * vf->vf_height)) h = (size.tp_row * vf->vf_height) - vd->vd_my - 1; - vd->vd_driver->vd_bitbltchr(vd, m->map, m->mask, bpl, + vd->vd_driver->vd_bitbltchr(vd, cursor->map, cursor->mask, bpl, vd->vd_offset.tp_row + vd->vd_my, vd->vd_offset.tp_col + vd->vd_mx, w, h, TC_WHITE, TC_BLACK);