summaryrefslogtreecommitdiffstats
path: root/sys/dev/vt/vt_core.c
diff options
context:
space:
mode:
authordumbbell <dumbbell@FreeBSD.org>2014-08-21 14:54:37 +0000
committerdumbbell <dumbbell@FreeBSD.org>2014-08-21 14:54:37 +0000
commit703993bfff92580124361d12ded4ef4d2015e6ec (patch)
tree645d3126d6b20265f4f620011cf88c01ec3e6415 /sys/dev/vt/vt_core.c
parentd549eef0643651b91b6f69f5a382316d2518596d (diff)
downloadFreeBSD-src-703993bfff92580124361d12ded4ef4d2015e6ec.zip
FreeBSD-src-703993bfff92580124361d12ded4ef4d2015e6ec.tar.gz
vt(4): If the cursor didn't move, don't mark its position as dirty
Currently, this has no effect, because the cursor is always redrawn anyway. But this will be useful after improvements to the vd_bitbltchr_t callback API. The vt_device structure members used to store the position of the cursor as of the last redraw are renamed from vd_mdirty{x,y} to vd_mold{x,y}. The associated comment is fixed too. Also, their value is now expressed in pixels, not in character columns/row. MFC after: 1 week
Diffstat (limited to 'sys/dev/vt/vt_core.c')
-rw-r--r--sys/dev/vt/vt_core.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index e334163..6ce84e2 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -835,9 +835,33 @@ vt_flush(struct vt_device *vd)
#ifndef SC_NO_CUTPASTE
if ((vd->vd_flags & VDF_MOUSECURSOR) && /* Mouse support enabled. */
!(vw->vw_flags & VWF_MOUSE_HIDE)) { /* Cursor displayed. */
- /* Mark last mouse position as dirty to erase. */
- vtbuf_mouse_cursor_position(&vw->vw_buf, vd->vd_mdirtyx,
- vd->vd_mdirtyy);
+ if (vd->vd_moldx != vd->vd_mx ||
+ vd->vd_moldy != vd->vd_my) {
+ /*
+ * Mark last mouse position as dirty to erase.
+ *
+ * FIXME: The font size could be different among
+ * all windows, so the column/row calculation
+ * below isn't correct for all windows.
+ *
+ * FIXME: The cursor can span more than one
+ * character cell. vtbuf_mouse_cursor_position
+ * marks surrounding cells as dirty. But due
+ * to font size possibly inconsistent across
+ * windows, this may not be sufficient. This
+ * causes part of the cursor to not be erased.
+ */
+ vtbuf_mouse_cursor_position(&vw->vw_buf,
+ vd->vd_moldx / vf->vf_width,
+ vd->vd_moldy / vf->vf_height);
+
+ /*
+ * Save point of last mouse cursor to erase it
+ * later.
+ */
+ vd->vd_moldx = vd->vd_mx;
+ vd->vd_moldy = vd->vd_my;
+ }
}
#endif
@@ -892,9 +916,6 @@ vt_flush(struct vt_device *vd)
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;
}
#endif
}
OpenPOWER on IntegriCloud