svn commit: r258130 - user/ed/newcons/sys/dev/vt

Aleksandr Rybalko ray at FreeBSD.org
Thu Nov 14 13:25:48 UTC 2013


Author: ray
Date: Thu Nov 14 13:25:47 2013
New Revision: 258130
URL: http://svnweb.freebsd.org/changeset/base/258130

Log:
  Save last mouse event and check if the button1-up event happen w/o movement,
  then ignore it. Otherwise such events broke double/triple click sequence.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  user/ed/newcons/sys/dev/vt/vt.h
  user/ed/newcons/sys/dev/vt/vt_buf.c
  user/ed/newcons/sys/dev/vt/vt_core.c

Modified: user/ed/newcons/sys/dev/vt/vt.h
==============================================================================
--- user/ed/newcons/sys/dev/vt/vt.h	Thu Nov 14 12:14:27 2013	(r258129)
+++ user/ed/newcons/sys/dev/vt/vt.h	Thu Nov 14 13:25:47 2013	(r258130)
@@ -160,6 +160,7 @@ struct vt_buf {
 	term_pos_t		 vb_cursor;	/* (u) Cursor position. */
 	term_pos_t		 vb_mark_start;	/* (b) Copy region start. */
 	term_pos_t		 vb_mark_end;	/* (b) Copy region end. */
+	int			 vb_mark_last;	/* Last mouse event. */
 	term_rect_t		 vb_dirtyrect;	/* (b) Dirty rectangle. */
 	struct vt_bufmask	 vb_dirtymask;	/* (b) Dirty bitmasks. */
 	term_char_t		*vb_buffer;	/* (u) Data buffer. */
@@ -189,6 +190,7 @@ void vtbuf_extract_marked(struct vt_buf 
 #define	VTB_MARK_WORD		3
 #define	VTB_MARK_ROW		4
 #define	VTB_MARK_EXTEND		5
+#define	VTB_MARK_MOVE		6
 
 #define	VTBUF_SLCK_ENABLE(vb)	vtbuf_scroll_mode((vb), 1)
 #define	VTBUF_SLCK_DISABLE(vb)	vtbuf_scroll_mode((vb), 0)

Modified: user/ed/newcons/sys/dev/vt/vt_buf.c
==============================================================================
--- user/ed/newcons/sys/dev/vt/vt_buf.c	Thu Nov 14 12:14:27 2013	(r258129)
+++ user/ed/newcons/sys/dev/vt/vt_buf.c	Thu Nov 14 13:25:47 2013	(r258130)
@@ -627,7 +627,11 @@ vtbuf_set_mark(struct vt_buf *vb, int ty
 {
 
 	switch (type) {
-	case VTB_MARK_END:
+	case VTB_MARK_END:	/* B1 UP */
+		if (vb->vb_mark_last != VTB_MARK_MOVE)
+			return (0);
+		/* FALLTHROUGH */
+	case VTB_MARK_MOVE:
 	case VTB_MARK_EXTEND:
 		vtbuf_flush_mark(vb); /* Clean old mark. */
 		vb->vb_mark_end.tp_col = col;
@@ -656,11 +660,14 @@ vtbuf_set_mark(struct vt_buf *vb, int ty
 		    vtbuf_wth(vb, row);
 		break;
 	case VTB_MARK_NONE:
+		vb->vb_mark_last = type;
+		/* FALLTHROUGH */
 	default:
 		/* panic? */
 		return (0);
 	}
 
+	vb->vb_mark_last = type;
 	/* Draw new marked region. */
 	vtbuf_flush_mark(vb);
 	return (1);

Modified: user/ed/newcons/sys/dev/vt/vt_core.c
==============================================================================
--- user/ed/newcons/sys/dev/vt/vt_core.c	Thu Nov 14 12:14:27 2013	(r258129)
+++ user/ed/newcons/sys/dev/vt/vt_core.c	Thu Nov 14 13:25:47 2013	(r258130)
@@ -1102,7 +1102,7 @@ vt_mouse_event(int type, int x, int y, i
 		vd->vd_mx = x;
 		vd->vd_my = y;
 		if ((vd->vd_mstate & MOUSE_BUTTON1DOWN) &&
-		    (vtbuf_set_mark(&vw->vw_buf, VTB_MARK_END,
+		    (vtbuf_set_mark(&vw->vw_buf, VTB_MARK_MOVE,
 			vd->vd_mx / vf->vf_width, 
 			vd->vd_my / vf->vf_height) == 1)) {
 
@@ -1170,7 +1170,7 @@ vt_mouse_event(int type, int x, int y, i
 		switch (cnt) {
 		case 0:	/* up */
 			if (!(vd->vd_mstate & MOUSE_BUTTON1DOWN))
-				mark = VTB_MARK_END;
+				mark = VTB_MARK_EXTEND;
 			else
 				mark = 0;
 			break;


More information about the svn-src-user mailing list