[vte/vte-0-34] Revert "Add urxvt extended mouse tracking mode support"



commit 580bc054a083c020ab658183864ab44ba8589c85
Author: Christian Persch <chpe gnome org>
Date:   Tue Aug 21 00:33:26 2012 +0200

    Revert "Add urxvt extended mouse tracking mode support"
    
    This reverts commit 60e0ce9ff6b27787c47c266e779d80e3389babe9.

 src/vte-private.h |    1 -
 src/vte.c         |   58 +++++++++++++++++++---------------------------------
 src/vteseq.c      |    5 ----
 3 files changed, 21 insertions(+), 43 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index d2cc6a3..2e1f9cc 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -305,7 +305,6 @@ struct _VteTerminalPrivate {
 	long mouse_last_x, mouse_last_y;
 	gboolean mouse_autohide;
 	guint mouse_autoscroll_tag;
-	gboolean mouse_urxvt_extension;
 
 	/* State variables for handling match checks. */
 	char *match_contents;
diff --git a/src/vte.c b/src/vte.c
index 3801f74..35fa597 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -5838,11 +5838,10 @@ vte_terminal_get_mouse_tracking_info (VteTerminal   *terminal,
 				      long           col,
 				      long           row,
 				      unsigned char *pb,
-				      long          *px,
-				      long          *py)
+				      unsigned char *px,
+				      unsigned char *py)
 {
-	unsigned char cb = 0;
-	long cx, cy;
+	unsigned char cb = 0, cx = 0, cy = 0;
 
 	/* Encode the button information in cb. */
 	switch (button) {
@@ -5878,11 +5877,11 @@ vte_terminal_get_mouse_tracking_info (VteTerminal   *terminal,
 		cb |= 16;
 	}
 
-	/* Clamp the cursor coordinates. */
-	cx = CLAMP(1 + col,
-		   1, terminal->column_count);
-	cy = CLAMP(1 + row,
-		   1, terminal->row_count);
+	/* Encode the cursor coordinates. */
+	cx = 32 + CLAMP(1 + col,
+			1, terminal->column_count);
+	cy = 32 + CLAMP(1 + row,
+			1, terminal->row_count);;
 
 	*pb = cb;
 	*px = cx;
@@ -5890,34 +5889,14 @@ vte_terminal_get_mouse_tracking_info (VteTerminal   *terminal,
 }
 
 static void
-vte_terminal_feed_mouse_event(VteTerminal *terminal,
-                              int          cb,
-                              long         cx,
-                              long         cy)
-{
-	char buf[LINE_MAX];
-	gint len = 0;
-
-	if (terminal->pvt->mouse_urxvt_extension) {
-		/* urxvt's extended mode (1015) */
-		len = g_snprintf(buf, sizeof(buf), _VTE_CAP_CSI "%d;%ld;%ldM", cb, cx, cy);
-	} else if (cx <= 231 && cy <= 231) {
-		/* legacy mode */
-		len = g_snprintf(buf, sizeof(buf), _VTE_CAP_CSI "M%c%c%c", cb, 32 + (guchar)cx, 32 + (guchar)cy);
-	}
-
-	/* Send event direct to the child, this is binary not text data */
-	vte_terminal_feed_child_binary(terminal, buf, len);
-}
-
-static void
 vte_terminal_send_mouse_button_internal(VteTerminal *terminal,
 					int          button,
 					long         x,
 					long         y)
 {
-	unsigned char cb;
-	long cx, cy;
+	unsigned char cb, cx, cy;
+	char buf[LINE_MAX];
+	gint len;
 	int width = terminal->char_width;
 	int height = terminal->char_height;
 	long col = (x - terminal->pvt->inner_border.left) / width;
@@ -5926,7 +5905,10 @@ vte_terminal_send_mouse_button_internal(VteTerminal *terminal,
 	vte_terminal_get_mouse_tracking_info (terminal,
 					      button, col, row,
 					      &cb, &cx, &cy);
-	vte_terminal_feed_mouse_event(terminal, cb, cx, cy);
+
+	/* Send event direct to the child, this is binary not text data */
+	len = g_snprintf(buf, sizeof(buf), _VTE_CAP_CSI "M%c%c%c", cb, cx, cy);
+	vte_terminal_feed_child_binary(terminal, buf, len);
 }
 
 /* Send a mouse button click/release notification. */
@@ -5962,8 +5944,9 @@ vte_terminal_maybe_send_mouse_button(VteTerminal *terminal,
 static void
 vte_terminal_maybe_send_mouse_drag(VteTerminal *terminal, GdkEventMotion *event)
 {
-	unsigned char cb;
-	long cx, cy;
+	unsigned char cb, cx, cy;
+	char buf[LINE_MAX];
+	gint len;
 	int width = terminal->char_width;
 	int height = terminal->char_height;
 	long col = ((long) event->x - terminal->pvt->inner_border.left) / width;
@@ -5997,7 +5980,9 @@ vte_terminal_maybe_send_mouse_drag(VteTerminal *terminal, GdkEventMotion *event)
 					      &cb, &cx, &cy);
 	cb += 32; /* for movement */
 
-	vte_terminal_feed_mouse_event(terminal, cb, cx, cy);
+	/* Send event direct to the child, this is binary not text data */
+	len = g_snprintf(buf, sizeof(buf), _VTE_CAP_CSI "M%c%c%c", cb, cx, cy);
+	vte_terminal_feed_child_binary(terminal, buf, len);
 }
 
 /* Clear all match hilites. */
@@ -14209,7 +14194,6 @@ vte_terminal_reset(VteTerminal *terminal,
 	pvt->mouse_last_button = 0;
 	pvt->mouse_last_x = 0;
 	pvt->mouse_last_y = 0;
-	pvt->mouse_urxvt_extension = FALSE;
 	/* Clear modifiers. */
 	pvt->modifiers = 0;
 	/* Cause everything to be redrawn (or cleared). */
diff --git a/src/vteseq.c b/src/vteseq.c
index 23745a1..07b1524 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -689,11 +689,6 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
 		{1010, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
 		/* 1011/rxvt: disallowed, scroll-on-keypress is set by user. */
 		{1011, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
-		/* 1015/urxvt: Extended mouse coordinates. */
-		{1015, &terminal->pvt->mouse_urxvt_extension, NULL, NULL,
-		 GINT_TO_POINTER(FALSE),
-		 GINT_TO_POINTER(TRUE),
-		 NULL, NULL,},
 		/* 1035: disallowed, don't know what to do with it. */
 		{1035, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
 		/* 1036: Meta-sends-escape. */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]