Date: Mon, 18 Nov 2013 22:55:50 +0000 (UTC) From: Aleksandr Rybalko <ray@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r258327 - user/ed/newcons/sys/dev/vt Message-ID: <201311182255.rAIMtoB1048498@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311182255.rAIMtoB1048498>