diff options
author | Benjamin Otte <otte@redhat.com> | 2010-10-10 08:31:45 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-10-30 01:49:59 +0800 |
commit | b3a95d0299386bccbdebb967d15f4df02cf15891 (patch) | |
tree | 52b90e4b913bb1c4cd17df3335216bf518a6e01c /libgnomecanvas/gnome-canvas-shape.c | |
parent | 08e71ba8ae72f333f017c25168b9ec85ea5954fa (diff) | |
download | gsoc2013-evolution-b3a95d0299386bccbdebb967d15f4df02cf15891.tar gsoc2013-evolution-b3a95d0299386bccbdebb967d15f4df02cf15891.tar.gz gsoc2013-evolution-b3a95d0299386bccbdebb967d15f4df02cf15891.tar.bz2 gsoc2013-evolution-b3a95d0299386bccbdebb967d15f4df02cf15891.tar.lz gsoc2013-evolution-b3a95d0299386bccbdebb967d15f4df02cf15891.tar.xz gsoc2013-evolution-b3a95d0299386bccbdebb967d15f4df02cf15891.tar.zst gsoc2013-evolution-b3a95d0299386bccbdebb967d15f4df02cf15891.zip |
gnome-canvas: Change GnomeCanvasItem->point vfunc
Previously the function returned the distance to the nearest item. Now
it only returns an item that is hit. This slightly changes semantics
(button events are no longer dispatched to the nearest item, but only to
the item actually clicked on), but makes the code way simpler and
actually does what one would expect.
Diffstat (limited to 'libgnomecanvas/gnome-canvas-shape.c')
-rw-r--r-- | libgnomecanvas/gnome-canvas-shape.c | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/libgnomecanvas/gnome-canvas-shape.c b/libgnomecanvas/gnome-canvas-shape.c index 70f3516160..d1e7c1c3c3 100644 --- a/libgnomecanvas/gnome-canvas-shape.c +++ b/libgnomecanvas/gnome-canvas-shape.c @@ -75,8 +75,8 @@ static void gnome_canvas_shape_realize (GnomeCanvasItem *item); static void gnome_canvas_shape_unrealize (GnomeCanvasItem *item); static void gnome_canvas_shape_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint width, gint height); -static gdouble gnome_canvas_shape_point (GnomeCanvasItem *item, gdouble x, gdouble y, - gint cx, gint cy, GnomeCanvasItem **actual_item); +static GnomeCanvasItem *gnome_canvas_shape_point (GnomeCanvasItem *item, gdouble x, gdouble y, + gint cx, gint cy); static void gnome_canvas_shape_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2); @@ -1084,12 +1084,11 @@ gnome_canvas_shape_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_ gnome_canvas_shape_update_gdk (shape, affine, clip_path, flags); } -static double +static GnomeCanvasItem * gnome_canvas_shape_point (GnomeCanvasItem *item, gdouble x, gdouble y, - gint cx, gint cy, GnomeCanvasItem **actual_item) + gint cx, gint cy) { GnomeCanvasShape *shape; - gdouble dist; gint wind; #if 0 @@ -1104,35 +1103,19 @@ gnome_canvas_shape_point (GnomeCanvasItem *item, gdouble x, gdouble y, /* todo: update? */ if (shape->priv->fill_set && shape->priv->fill_svp) { wind = art_svp_point_wind (shape->priv->fill_svp, cx, cy); - if ((shape->priv->wind == ART_WIND_RULE_NONZERO) && (wind != 0)) { - *actual_item = item; - return 0.0; - } - if ((shape->priv->wind == ART_WIND_RULE_ODDEVEN) && ((wind & 0x1) != 0)) { - *actual_item = item; - return 0.0; - } + if ((shape->priv->wind == ART_WIND_RULE_NONZERO) && (wind != 0)) + return item; + if ((shape->priv->wind == ART_WIND_RULE_ODDEVEN) && ((wind & 0x1) != 0)) + return item; } if (shape->priv->outline_set && shape->priv->outline_svp) { wind = art_svp_point_wind (shape->priv->outline_svp, cx, cy); - if (wind) { - *actual_item = item; - return 0.0; - } - } - - if (shape->priv->outline_set && shape->priv->outline_svp) { - dist = art_svp_point_dist (shape->priv->outline_svp, cx, cy); - } else if (shape->priv->fill_set && shape->priv->outline_svp) { - dist = art_svp_point_dist (shape->priv->fill_svp, cx, cy); - } else { - return 1e12; + if (wind) + return item; } - *actual_item = item; - - return dist; + return NULL; } /* Helpers */ |