Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Aug 2014 17:16:52 +0000 (UTC)
From:      Jean-Sebastien Pedron <dumbbell@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r270721 - head/sys/dev/vt
Message-ID:  <201408271716.s7RHGq4r077537@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dumbbell
Date: Wed Aug 27 17:16:52 2014
New Revision: 270721
URL: http://svnweb.freebsd.org/changeset/base/270721

Log:
  vt(4): If the terminal shrinks, make sure the mouse is inside the new area
  
  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	Wed Aug 27 15:10:28 2014	(r270720)
+++ head/sys/dev/vt/vt_core.c	Wed Aug 27 17:16:52 2014	(r270721)
@@ -1381,9 +1381,20 @@ vt_change_font(struct vt_window *vw, str
 		 */
 		vtfont_unref(vw->vw_font);
 		vw->vw_font = vtfont_ref(vf);
-		vt_compute_drawable_area(vw);
 	}
 
+	/*
+	 * Compute the drawable area and move the mouse cursor inside
+	 * it, in case the new area is smaller than the previous one.
+	 */
+	vt_compute_drawable_area(vw);
+	vd->vd_mx = min(vd->vd_mx,
+	    vw->vw_draw_area.tr_end.tp_col -
+	    vw->vw_draw_area.tr_begin.tp_col - 1);
+	vd->vd_my = min(vd->vd_my,
+	    vw->vw_draw_area.tr_end.tp_row -
+	    vw->vw_draw_area.tr_begin.tp_row - 1);
+
 	/* Force a full redraw the next timer tick. */
 	if (vd->vd_curwindow == vw) {
 		vt_set_border(vw, vf, TC_BLACK);
@@ -2272,8 +2283,8 @@ vt_resize(struct vt_device *vd)
 		if (!(vd->vd_flags & VDF_TEXTMODE) && vw->vw_font == NULL)
 			vw->vw_font = vtfont_ref(&vt_font_default);
 		VT_UNLOCK(vd);
+
 		/* Resize terminal windows */
-		vt_compute_drawable_area(vw);
 		while (vt_change_font(vw, vw->vw_font) == EBUSY) {
 			DPRINTF(100, "%s: vt_change_font() is busy, "
 			    "window %d\n", __func__, i);



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