From owner-svn-src-user@FreeBSD.ORG Mon Nov 18 22:55:51 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7B69E760; Mon, 18 Nov 2013 22:55:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6A5C32E29; Mon, 18 Nov 2013 22:55:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rAIMtpeV048503; Mon, 18 Nov 2013 22:55:51 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rAIMtoB1048498; Mon, 18 Nov 2013 22:55:50 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201311182255.rAIMtoB1048498@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 18 Nov 2013 22:55:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r258327 - user/ed/newcons/sys/dev/vt X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2013 22:55:51 -0000 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);