From b3a95d0299386bccbdebb967d15f4df02cf15891 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 10 Oct 2010 02:31:45 +0200 Subject: 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. --- widgets/misc/e-canvas-background.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'widgets/misc/e-canvas-background.c') diff --git a/widgets/misc/e-canvas-background.c b/widgets/misc/e-canvas-background.c index f6179379e4..b2be246f21 100644 --- a/widgets/misc/e-canvas-background.c +++ b/widgets/misc/e-canvas-background.c @@ -371,23 +371,21 @@ ecb_draw (GnomeCanvasItem *item, x1, y1, x2 - x1, y2 - y1); } -static double -ecb_point (GnomeCanvasItem *item, gdouble x, gdouble y, gint cx, gint cy, - GnomeCanvasItem **actual_item) +static GnomeCanvasItem * +ecb_point (GnomeCanvasItem *item, gdouble x, gdouble y, gint cx, gint cy) { ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item); if (ecb->priv->x1 >= 0 && ecb->priv->x1 > x) - return 1.0; + return NULL; if (ecb->priv->x2 >= 0 && ecb->priv->x2 < x) - return 1.0; + return NULL; if (ecb->priv->y1 >= 0 && ecb->priv->y1 > y) - return 1.0; + return NULL; if (ecb->priv->y2 >= 0 && ecb->priv->y2 < y) - return 1.0; - *actual_item = item; + return NULL; - return 0.0; + return item; } static void -- cgit v1.2.3