Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Nov 2013 12:34:30 +0000 (UTC)
From:      Aleksandr Rybalko <ray@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r257981 - user/ed/newcons/sys/dev/vt
Message-ID:  <201311111234.rABCYUGZ042922@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ray
Date: Mon Nov 11 12:34:30 2013
New Revision: 257981
URL: http://svnweb.freebsd.org/changeset/base/257981

Log:
  o Update vt_flush to care about mouse pointer.
  o Sort variable declarations.
  o Disable mouse support for DDB.
  o Expose region to update on old mouse position.
  o Draw mouse cursor on current position.
  
  There is some extra bits for calculation of size to copy bitmap to screen.
  It is not supported by drivers, but will be changed in following commits.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  user/ed/newcons/sys/dev/vt/vt_core.c

Modified: user/ed/newcons/sys/dev/vt/vt_core.c
==============================================================================
--- user/ed/newcons/sys/dev/vt/vt_core.c	Mon Nov 11 12:26:35 2013	(r257980)
+++ user/ed/newcons/sys/dev/vt/vt_core.c	Mon Nov 11 12:34:30 2013	(r257981)
@@ -652,11 +652,13 @@ vt_flush(struct vt_device *vd)
 {
 	struct vt_window *vw = vd->vd_curwindow;
 	struct vt_font *vf = vw->vw_font;
-	term_pos_t size;
-	term_rect_t tarea;
 	struct vt_bufmask tmask;
+	struct mouse_cursor *m;
 	unsigned int row, col;
+	term_rect_t tarea;
+	term_pos_t size;
 	term_char_t *r;
+	int h, w;
 
 	if (vd->vd_flags & VDF_SPLASH || vw->vw_flags & VWF_BUSY)
 		return;
@@ -673,6 +675,12 @@ vt_flush(struct vt_device *vd)
 		vd->vd_flags &= ~VDF_INVALID;
 	}
 
+	/* No mouse for DDB. */
+	if (kdb_active || panicstr != NULL)
+		return;
+
+	/* Mark last mouse position as dirty to erase. */
+	vtbuf_mouse_cursor_position(&vw->vw_buf, vd->vd_mdirtyx, vd->vd_mdirtyy);
 
 	for (row = tarea.tr_begin.tp_row; row < tarea.tr_end.tp_row; row++) {
 		if (!VTBUF_DIRTYROW(&tmask, row))
@@ -687,6 +695,26 @@ vt_flush(struct vt_device *vd)
 			    VTBUF_ISCURSOR(&vw->vw_buf, row, col), row, col);
 		}
 	}
+
+	if ((vd->vd_flags & (VDF_MOUSECURSOR|VDF_TEXTMODE)) ==
+	    VDF_MOUSECURSOR) {
+		m = &vt_default_mouse_pointer;
+		w = m->w;
+		h = m->h;
+
+		if ((vd->vd_mx + m->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))
+			h = (size.tp_row * vf->vf_height) - vd->vd_my - 1;
+
+		vd->vd_driver->vd_bitbltchr(vd, m->map,
+		    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;
+	}
 }
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311111234.rABCYUGZ042922>