From 446bfa8ee109db81e22a1fe3042f2abeec4d8e13 Mon Sep 17 00:00:00 2001 From: Jesse van den Kieboom Date: Sat, 12 Jul 2014 10:36:00 +0200 Subject: [PATCH] Select ref rows on button press ListBox is designed to handle gestures, which means that it will wait for a release to actually select a row. This in turn means that there is a user noticeable delay in selecting rows in the refs list with the mouse. We override button_press_event to select the row directly on a button press. --- gitg/history/gitg-history-refs-list.vala | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gitg/history/gitg-history-refs-list.vala b/gitg/history/gitg-history-refs-list.vala index 3231e807..6ad114f0 100644 --- a/gitg/history/gitg-history-refs-list.vala +++ b/gitg/history/gitg-history-refs-list.vala @@ -873,6 +873,19 @@ public class RefsList : Gtk.ListBox var row = d_ref_map[reference]; row.begin_editing((owned)done); } + + 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); + + if (row != null && row != get_selected_row()) + { + select_row(row); + } + + return ret; + } } }