Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Dec 2013 15:01:34 +0000 (UTC)
From:      Aleksandr Rybalko <ray@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r259129 - in head/sys/dev/vt: . font
Message-ID:  <201312091501.rB9F1YOJ053006@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ray
Date: Mon Dec  9 15:01:34 2013
New Revision: 259129
URL: http://svnweb.freebsd.org/changeset/base/259129

Log:
  Respect SC_NO_CUTPASTE option. It disable mouse cursor and cut/paste support
  for vt(9). Note: /dev/sysmouse not affected.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/dev/vt/font/vt_mouse_cursor.c
  head/sys/dev/vt/vt.h
  head/sys/dev/vt/vt_buf.c
  head/sys/dev/vt/vt_core.c
  head/sys/dev/vt/vt_sysmouse.c

Modified: head/sys/dev/vt/font/vt_mouse_cursor.c
==============================================================================
--- head/sys/dev/vt/font/vt_mouse_cursor.c	Mon Dec  9 13:44:07 2013	(r259128)
+++ head/sys/dev/vt/font/vt_mouse_cursor.c	Mon Dec  9 15:01:34 2013	(r259129)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 
 #include <dev/vt/vt.h>
 
+#ifndef SC_NO_CUTPASTE
 struct mouse_cursor vt_default_mouse_pointer = {
 	.map = {
 		0x00, /* "__      " */
@@ -66,3 +67,4 @@ struct mouse_cursor vt_default_mouse_poi
 	.w = 8,
 	.h = 13,
 };
+#endif

Modified: head/sys/dev/vt/vt.h
==============================================================================
--- head/sys/dev/vt/vt.h	Mon Dec  9 13:44:07 2013	(r259128)
+++ head/sys/dev/vt/vt.h	Mon Dec  9 15:01:34 2013	(r259129)
@@ -181,15 +181,17 @@ void vtbuf_init(struct vt_buf *, const t
 void vtbuf_grow(struct vt_buf *, const term_pos_t *, int);
 void vtbuf_putchar(struct vt_buf *, const term_pos_t *, term_char_t);
 void vtbuf_cursor_position(struct vt_buf *, const term_pos_t *);
-void vtbuf_mouse_cursor_position(struct vt_buf *vb, int col, int row);
-void vtbuf_cursor_visibility(struct vt_buf *, int);
 void vtbuf_scroll_mode(struct vt_buf *vb, int yes);
 void vtbuf_undirty(struct vt_buf *, term_rect_t *, struct vt_bufmask *);
 void vtbuf_sethistory_size(struct vt_buf *, int);
-int vtbuf_set_mark(struct vt_buf *vb, int type, int col, int row);
 int vtbuf_iscursor(struct vt_buf *vb, int row, int col);
+void vtbuf_cursor_visibility(struct vt_buf *, int);
+#ifndef SC_NO_CUTPASTE
+void vtbuf_mouse_cursor_position(struct vt_buf *vb, int col, int row);
+int vtbuf_set_mark(struct vt_buf *vb, int type, int col, int row);
 int vtbuf_get_marked_len(struct vt_buf *vb);
 void vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz);
+#endif
 
 #define	VTB_MARK_NONE		0
 #define	VTB_MARK_END		1
@@ -389,12 +391,14 @@ struct vt_font {
 	unsigned int		 vf_refcount;
 };
 
+#ifndef SC_NO_CUTPASTE
 struct mouse_cursor {
 	uint8_t map[64 * 64 / 8];
 	uint8_t mask[64 * 64 / 8];
 	uint8_t w;
 	uint8_t h;
 };
+#endif
 
 const uint8_t	*vtfont_lookup(const struct vt_font *vf, term_char_t c);
 struct vt_font	*vtfont_ref(struct vt_font *vf);
@@ -403,8 +407,10 @@ int		 vtfont_load(vfnt_t *f, struct vt_f
 
 /* Sysmouse. */
 void sysmouse_process_event(mouse_info_t *mi);
+#ifndef SC_NO_CUTPASTE
 void vt_mouse_event(int type, int x, int y, int event, int cnt);
 void vt_mouse_state(int show);
+#endif
 #define	VT_MOUSE_SHOW 1
 #define	VT_MOUSE_HIDE 0
 

Modified: head/sys/dev/vt/vt_buf.c
==============================================================================
--- head/sys/dev/vt/vt_buf.c	Mon Dec  9 13:44:07 2013	(r259128)
+++ head/sys/dev/vt/vt_buf.c	Mon Dec  9 15:01:34 2013	(r259129)
@@ -135,6 +135,7 @@ vthistory_getpos(const struct vt_buf *vb
 	*offset = vb->vb_roffset;
 }
 
+#ifndef SC_NO_CUTPASTE	/* Only mouse support use it now. */
 /* Translate current view row number to history row. */
 static int
 vtbuf_wth(struct vt_buf *vb, int row)
@@ -142,6 +143,7 @@ vtbuf_wth(struct vt_buf *vb, int row)
 
 	return ((vb->vb_roffset + row) % vb->vb_history_size);
 }
+#endif
 
 /* Translate history row to current view row number. */
 static int
@@ -531,6 +533,7 @@ vtbuf_cursor_position(struct vt_buf *vb,
 	}
 }
 
+#ifndef SC_NO_CUTPASTE
 void
 vtbuf_mouse_cursor_position(struct vt_buf *vb, int col, int row)
 {
@@ -691,6 +694,7 @@ vtbuf_set_mark(struct vt_buf *vb, int ty
 	vtbuf_flush_mark(vb);
 	return (1);
 }
+#endif
 
 void
 vtbuf_cursor_visibility(struct vt_buf *vb, int yes)

Modified: head/sys/dev/vt/vt_core.c
==============================================================================
--- head/sys/dev/vt/vt_core.c	Mon Dec  9 13:44:07 2013	(r259128)
+++ head/sys/dev/vt/vt_core.c	Mon Dec  9 15:01:34 2013	(r259129)
@@ -127,7 +127,9 @@ extern unsigned char vt_logo_image[];
 
 /* Font. */
 extern struct vt_font vt_font_default;
+#ifndef SC_NO_CUTPASTE
 extern struct mouse_cursor vt_default_mouse_pointer;
+#endif
 
 static int signal_vt_rel(struct vt_window *);
 static int signal_vt_acq(struct vt_window *);
@@ -689,12 +691,14 @@ vt_flush(struct vt_device *vd)
 	struct vt_window *vw = vd->vd_curwindow;
 	struct vt_font *vf = vw->vw_font;
 	struct vt_bufmask tmask;
-	struct mouse_cursor *m;
 	unsigned int row, col;
 	term_rect_t tarea;
 	term_pos_t size;
 	term_char_t *r;
+#ifndef SC_NO_CUTPASTE
+	struct mouse_cursor *m;
 	int bpl, h, w;
+#endif
 
 	if (vd->vd_flags & VDF_SPLASH || vw->vw_flags & VWF_BUSY)
 		return;
@@ -711,11 +715,13 @@ vt_flush(struct vt_device *vd)
 		vd->vd_flags &= ~VDF_INVALID;
 	}
 
+#ifndef SC_NO_CUTPASTE
 	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);
 	}
+#endif
 
 	for (row = tarea.tr_begin.tp_row; row < tarea.tr_end.tp_row; row++) {
 		if (!VTBUF_DIRTYROW(&tmask, row))
@@ -731,6 +737,7 @@ vt_flush(struct vt_device *vd)
 		}
 	}
 
+#ifndef SC_NO_CUTPASTE
 	/* Mouse disabled. */
 	if (vw->vw_flags & VWF_MOUSE_HIDE)
 		return;
@@ -759,6 +766,7 @@ vt_flush(struct vt_device *vd)
 		vd->vd_mdirtyx = vd->vd_mx / vf->vf_width;
 		vd->vd_mdirtyy = vd->vd_my / vf->vf_height;
 	}
+#endif
 }
 
 static void
@@ -1106,6 +1114,7 @@ finish_vt_acq(struct vt_window *vw)
 	return (EINVAL);
 }
 
+#ifndef SC_NO_CUTPASTE
 void
 vt_mouse_event(int type, int x, int y, int event, int cnt)
 {
@@ -1265,6 +1274,7 @@ vt_mouse_state(int show)
 		break;
 	}
 }
+#endif
 
 static int
 vtterm_ioctl(struct terminal *tm, u_long cmd, caddr_t data,

Modified: head/sys/dev/vt/vt_sysmouse.c
==============================================================================
--- head/sys/dev/vt/vt_sysmouse.c	Mon Dec  9 13:44:07 2013	(r259128)
+++ head/sys/dev/vt/vt_sysmouse.c	Mon Dec  9 15:01:34 2013	(r259129)
@@ -190,9 +190,11 @@ sysmouse_process_event(mouse_info_t *mi)
 
 	sysmouse_buf_store(buf);
 
+#ifndef SC_NO_CUTPASTE
 	mtx_unlock(&sysmouse_lock);
 	vt_mouse_event(mi->operation, x, y, mi->u.event.id, mi->u.event.value);
 	return;
+#endif
 
 done:	mtx_unlock(&sysmouse_lock);
 }
@@ -345,7 +347,9 @@ sysmouse_ioctl(struct cdev *dev, u_long 
 			return (EINVAL);
 
 		sysmouse_level = level;
+#ifndef SC_NO_CUTPASTE
 		vt_mouse_state((level == 0)?VT_MOUSE_SHOW:VT_MOUSE_HIDE);
+#endif
 		return (0);
 	}
 	case MOUSE_SETMODE: {
@@ -358,8 +362,10 @@ sysmouse_ioctl(struct cdev *dev, u_long 
 		case 0:
 		case 1:
 			sysmouse_level = mode->level;
+#ifndef SC_NO_CUTPASTE
 			vt_mouse_state((mode->level == 0)?VT_MOUSE_SHOW:
 			    VT_MOUSE_HIDE);
+#endif
 			break;
 		default:
 			return (EINVAL);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312091501.rB9F1YOJ053006>