[vte/vte-next] Use vte_terminal_xy_to_grid in vte_terminal_send_mouse_button_internal



commit b26d282244b77c581ac7f987075d289cc4f33919
Author: Christian Persch <chpe gnome org>
Date:   Sat May 7 21:46:08 2011 +0200

    Use vte_terminal_xy_to_grid in vte_terminal_send_mouse_button_internal

 src/vte.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index 9c094de..ecb7231 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -5151,6 +5151,13 @@ vte_terminal_get_mouse_tracking_info (VteTerminal   *terminal,
 	*py = cy;
 }
 
+/*
+ * vte_terminal_send_mouse_button_internal:
+ * @terminal:
+ * @button: the mouse button, or 0 for keyboard
+ * @x: the event X coordinate
+ * @y: the event Y coordinate
+ */
 static void
 vte_terminal_send_mouse_button_internal(VteTerminal *terminal,
 					int          button,
@@ -5160,10 +5167,10 @@ vte_terminal_send_mouse_button_internal(VteTerminal *terminal,
 	unsigned char cb, cx, cy;
 	char buf[LINE_MAX];
 	gint len;
-	int width = terminal->pvt->char_width;
-	int height = terminal->pvt->char_height;
-	long col = (x - terminal->pvt->padding.left) / width;
-	long row = (y - terminal->pvt->padding.top) / height;
+        long col, row;
+
+        if (!_vte_terminal_xy_to_grid(terminal, x, y, &col, &row))
+                return;
 
 	vte_terminal_get_mouse_tracking_info (terminal,
 					      button, col, row,



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