summaryrefslogtreecommitdiffstats
path: root/sys/dev/vt
diff options
context:
space:
mode:
authordumbbell <dumbbell@FreeBSD.org>2014-08-27 17:16:52 +0000
committerdumbbell <dumbbell@FreeBSD.org>2014-08-27 17:16:52 +0000
commit49e3e80d4cbf15bf952a70f81c09c2ef189e4795 (patch)
treed5c4a4ec98449a57b1ec2b904d7dd2c15ae1480c /sys/dev/vt
parent0305dad6ea32064a43f1782be848ade1e42edfeb (diff)
downloadFreeBSD-src-49e3e80d4cbf15bf952a70f81c09c2ef189e4795.zip
FreeBSD-src-49e3e80d4cbf15bf952a70f81c09c2ef189e4795.tar.gz
vt(4): If the terminal shrinks, make sure the mouse is inside the new area
MFC after: 1 week
Diffstat (limited to 'sys/dev/vt')
-rw-r--r--sys/dev/vt/vt_core.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index 243a392..6ccd53b 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -1381,9 +1381,20 @@ vt_change_font(struct vt_window *vw, struct vt_font *vf)
*/
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);
OpenPOWER on IntegriCloud