svn commit: r258327 - user/ed/newcons/sys/dev/vt
Aleksandr Rybalko
ray at FreeBSD.org
Mon Nov 18 22:55:51 UTC 2013
Author: ray
Date: Mon Nov 18 22:55:50 2013
New Revision: 258327
URL: http://svnweb.freebsd.org/changeset/base/258327
Log:
Notify terminal about process on current terminal start to use mouse on a
different "mouse level".
Sponsored by: The FreeBSD Foundation
Modified:
user/ed/newcons/sys/dev/vt/vt.h
user/ed/newcons/sys/dev/vt/vt_core.c
user/ed/newcons/sys/dev/vt/vt_sysmouse.c
Modified: user/ed/newcons/sys/dev/vt/vt.h
==============================================================================
--- user/ed/newcons/sys/dev/vt/vt.h Mon Nov 18 22:53:24 2013 (r258326)
+++ user/ed/newcons/sys/dev/vt/vt.h Mon Nov 18 22:55:50 2013 (r258327)
@@ -241,6 +241,7 @@ struct vt_window {
#define VWF_SCROLL 0x4 /* Keys influence scrollback. */
#define VWF_CONSOLE 0x8 /* Kernel message console window. */
#define VWF_VTYLOCK 0x10 /* Prevent window switch. */
+#define VWF_MOUSE_HIDE 0x20 /* Disable mouse events processing. */
#define VWF_SWWAIT_REL 0x10000 /* Program wait for VT acquire is done. */
#define VWF_SWWAIT_ACQ 0x20000 /* Program wait for VT release is done. */
pid_t vw_pid; /* Terminal holding process */
@@ -401,5 +402,9 @@ int vtfont_load(vfnt_t *f, struct vt_f
/* Sysmouse. */
void sysmouse_process_event(mouse_info_t *mi);
void vt_mouse_event(int type, int x, int y, int event, int cnt);
+void vt_mouse_state(int show);
+#define VT_MOUSE_SHOW 1
+#define VT_MOUSE_HIDE 0
#endif /* !_DEV_VT_VT_H_ */
+
Modified: user/ed/newcons/sys/dev/vt/vt_core.c
==============================================================================
--- user/ed/newcons/sys/dev/vt/vt_core.c Mon Nov 18 22:53:24 2013 (r258326)
+++ user/ed/newcons/sys/dev/vt/vt_core.c Mon Nov 18 22:55:50 2013 (r258327)
@@ -705,8 +705,11 @@ vt_flush(struct vt_device *vd)
vd->vd_flags &= ~VDF_INVALID;
}
- /* Mark last mouse position as dirty to erase. */
- vtbuf_mouse_cursor_position(&vw->vw_buf, vd->vd_mdirtyx, vd->vd_mdirtyy);
+ if ((vw->vw_flags & VWF_MOUSE_HIDE) == 0) {
+ /* 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))
@@ -722,6 +725,10 @@ vt_flush(struct vt_device *vd)
}
}
+ /* Mouse disabled. */
+ if (vw->vw_flags & VWF_MOUSE_HIDE)
+ return;
+
/* No mouse for DDB. */
if (kdb_active || panicstr != NULL)
return;
@@ -1103,6 +1110,9 @@ vt_mouse_event(int type, int x, int y, i
vw = vd->vd_curwindow;
vf = vw->vw_font;
+ if (vw->vw_flags & VWF_MOUSE_HIDE)
+ return; /* Mouse disabled. */
+
if (vf == NULL) /* Text mode. */
return;
@@ -1226,6 +1236,25 @@ vt_mouse_event(int type, int x, int y, i
}
}
+void
+vt_mouse_state(int show)
+{
+ struct vt_device *vd;
+ struct vt_window *vw;
+
+ vd = main_vd;
+ vw = vd->vd_curwindow;
+
+ switch (show) {
+ case VT_MOUSE_HIDE:
+ atomic_set_int(&vw->vw_flags, VWF_MOUSE_HIDE);
+ break;
+ case VT_MOUSE_SHOW:
+ atomic_clear_int(&vw->vw_flags, VWF_MOUSE_HIDE);
+ break;
+ }
+}
+
static int
vtterm_ioctl(struct terminal *tm, u_long cmd, caddr_t data,
struct thread *td)
Modified: user/ed/newcons/sys/dev/vt/vt_sysmouse.c
==============================================================================
--- user/ed/newcons/sys/dev/vt/vt_sysmouse.c Mon Nov 18 22:53:24 2013 (r258326)
+++ user/ed/newcons/sys/dev/vt/vt_sysmouse.c Mon Nov 18 22:55:50 2013 (r258327)
@@ -224,6 +224,7 @@ sysmouse_close(struct cdev *dev, int ffl
mtx_lock(&sysmouse_lock);
free(sysmouse_buffer, M_SYSMOUSE);
sysmouse_buffer = NULL;
+ sysmouse_level = 0;
mtx_unlock(&sysmouse_lock);
return (0);
@@ -344,6 +345,7 @@ sysmouse_ioctl(struct cdev *dev, u_long
return (EINVAL);
sysmouse_level = level;
+ vt_mouse_state((level == 0)?VT_MOUSE_SHOW:VT_MOUSE_HIDE);
return (0);
}
case MOUSE_SETMODE: {
@@ -356,6 +358,8 @@ sysmouse_ioctl(struct cdev *dev, u_long
case 0:
case 1:
sysmouse_level = mode->level;
+ vt_mouse_state((mode->level == 0)?VT_MOUSE_SHOW:
+ VT_MOUSE_HIDE);
break;
default:
return (EINVAL);
More information about the svn-src-user
mailing list