Catch click on prefix area
authorEnrico Zini <enrico@enricozini.org>
Mon, 14 Dec 2009 17:56:09 +0000 (17:56 +0000)
committerEnrico Zini <enrico@enricozini.org>
Mon, 14 Dec 2009 17:56:09 +0000 (17:56 +0000)
gtkfisheyelist/gtkfisheyelistview.vala

index c07b1e110094232f5f400018787bf52956ad4b7f..88f0e96c525f05165ae81f9cc3670587ee809243 100644 (file)
@@ -183,10 +183,12 @@ public class FisheyeListView : Gtk.DrawingArea
        /* Mouse button got released */
        public override bool button_release_event(Gdk.EventButton event)
        {
+               if (model == null) return false;
                //stderr.printf("Mouse released on %d %s\n", cur_el, label_cache[cur_el]);
 
                // Emit row_activated if applicable
-               if (model != null)
+               int x = (int)event.x;
+               if (x < allocation.width / 3)
                {
                        Gtk.TreeIter iter;
                        if (model.iter_nth_child(out iter, null, cur_el))
@@ -194,6 +196,8 @@ public class FisheyeListView : Gtk.DrawingArea
                                Gtk.TreePath path = model.get_path(iter);
                                row_activated(path);
                        }
+               } else if (cur_pfx != null && x > allocation.width * 2 / 3) {
+                       stderr.printf("Mouse released on prefix %s\n", cur_pfx.prefix);
                }
                return false;
        }