[gitg/wip/fetch: 9/9] Compute correct y position of row from event
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/fetch: 9/9] Compute correct y position of row from event
- Date: Tue, 23 Dec 2014 17:38:04 +0000 (UTC)
commit d6eff0ff1efb8f7aefb38a8c8072ca94c6f57026
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Tue Dec 23 17:42:00 2014 +0100
Compute correct y position of row from event
gitg/history/gitg-history-refs-list.vala | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/gitg/history/gitg-history-refs-list.vala b/gitg/history/gitg-history-refs-list.vala
index ee5e4d2..8e8fa1c 100644
--- a/gitg/history/gitg-history-refs-list.vala
+++ b/gitg/history/gitg-history-refs-list.vala
@@ -995,10 +995,29 @@ public class RefsList : Gtk.ListBox
row.begin_editing((owned)done);
}
+ private int y_in_window(int y, Gdk.Window origin)
+ {
+ while (origin != get_window())
+ {
+ int wx;
+ int wy;
+
+ origin.get_position(out wx, out wy);
+
+ y += wy;
+
+ origin = origin.get_parent();
+ }
+
+ return y;
+ }
+
protected override bool button_press_event(Gdk.EventButton button)
{
var ret = base.button_press_event(button);
- var row = get_row_at_y((int)button.y);
+
+ var y = y_in_window((int)button.y, button.window);
+ var row = get_row_at_y(y);
if (row != null && row != get_selected_row())
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]