summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgmont Koblinger <egmont@gmail.com>2015-10-03 21:26:11 +0200
committerEgmont Koblinger <egmont@gmail.com>2015-10-03 21:26:11 +0200
commitac3438cbdffd7886a93e6adbd8283e15d241bb50 (patch)
treecbc10beac3aea76924b3a3aee7b9b595c5116bce
parent18171bcfeaf8f3bf4bcb8a04dfcff916a3fbc40b (diff)
downloadvte-ac3438cbdffd7886a93e6adbd8283e15d241bb50.tar.gz
widget: Report correct mouse coordinates if viewport is scrolled back
https://bugzilla.gnome.org/show_bug.cgi?id=755187
-rw-r--r--src/vte.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/vte.cc b/src/vte.cc
index 014edd26..7fa282f5 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -6052,7 +6052,11 @@ vte_terminal_send_mouse_button_internal(VteTerminal *terminal,
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 row = (y - terminal->pvt->padding.top) / height -
+ (terminal->pvt->screen->insert_delta - terminal->pvt->screen->scroll_delta);
+
+ if (row < 0)
+ return;
vte_terminal_feed_mouse_event(terminal, button, FALSE /* not drag */, is_release, col, row);
}
@@ -6132,9 +6136,13 @@ vte_terminal_maybe_send_mouse_drag(VteTerminal *terminal, GdkEventMotion *event)
int width = terminal->pvt->char_width;
int height = terminal->pvt->char_height;
long col = ((long) event->x - terminal->pvt->padding.left) / width;
- long row = ((long) event->y - terminal->pvt->padding.top) / height;
+ long row = ((long) event->y - terminal->pvt->padding.top) / height -
+ (terminal->pvt->screen->insert_delta - terminal->pvt->screen->scroll_delta);
int button;
+ if (row < 0)
+ return FALSE;
+
/* First determine if we even want to send notification. */
switch (event->type) {
case GDK_MOTION_NOTIFY: