Fixed test positioning
authorEnrico Zini <enrico@enricozini.org>
Tue, 8 Dec 2009 18:29:29 +0000 (18:29 +0000)
committerEnrico Zini <enrico@enricozini.org>
Tue, 8 Dec 2009 18:29:29 +0000 (18:29 +0000)
src/fisheye.vala

index 7a8ccf0721e3427e317176bbd2d810e8f01658f5..09a9edc2b92d9634ac6b03c2c00b2f2698d238c8 100644 (file)
@@ -75,7 +75,7 @@ public class FisheyeList : Gtk.DrawingArea
                double x = event.x / allocation.width;
                double y = event.y / allocation.height;
 
-               focus_locked = x > 0.5 && y >= focus_starts[0] && y < focus_starts[focus_end - focus_first];
+               focus_locked = x < 0.5 && y >= focus_starts[0] && y < focus_starts[focus_end - focus_first];
 
                if (focus_locked)
                {
@@ -155,7 +155,7 @@ public class FisheyeList : Gtk.DrawingArea
        protected void draw(Cairo.Context context)
        {
                // White background (FIXME: get from style)
-               context.set_source_rgb(1, 1, 1);
+               context.set_source_rgb(0.7, 0.7, 0.7);
                context.paint();
                context.set_source_rgb(0, 0, 0);
 
@@ -182,17 +182,26 @@ public class FisheyeList : Gtk.DrawingArea
 
                        context.set_source_rgba(0, 0, 0, 1);
                        context.new_path();
-                       context.move_to(0, (y1+y0)/2);
                        context.set_font_size(y1-y0);
+                       Cairo.FontExtents extents;
+                       context.font_extents(out extents);
+                       context.move_to(0, y1-extents.descent);
                        context.text_path(list[idx]);
                        context.fill();
                        context.stroke();
                }
 
                // Paint focus lock area
+               context.set_source_rgba(1, 1, 1, 0.2);
+               context.new_path();
+               context.rectangle(0, focus_starts[0], 0.5, focus_starts[focus_end - focus_first]);
+               context.fill();
+               context.stroke();
+
+               // Paint focus movement area
                context.set_source_rgba(0.8, 1, 1, 0.8);
                context.new_path();
-               context.rectangle(0.5, focus_starts[0], 1, focus_starts[focus_end - focus_first]);
+               context.rectangle(0.5, 0, 1, 1);
                context.fill();
                context.stroke();
        }