From 49e3e80d4cbf15bf952a70f81c09c2ef189e4795 Mon Sep 17 00:00:00 2001 From: dumbbell Date: Wed, 27 Aug 2014 17:16:52 +0000 Subject: vt(4): If the terminal shrinks, make sure the mouse is inside the new area MFC after: 1 week --- sys/dev/vt/vt_core.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sys/dev/vt') 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); -- cgit v1.1