aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/text/e-reflow.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-10-10 08:31:45 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-30 01:49:59 +0800
commitb3a95d0299386bccbdebb967d15f4df02cf15891 (patch)
tree52b90e4b913bb1c4cd17df3335216bf518a6e01c /widgets/text/e-reflow.c
parent08e71ba8ae72f333f017c25168b9ec85ea5954fa (diff)
downloadgsoc2013-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 'widgets/text/e-reflow.c')
-rw-r--r--widgets/text/e-reflow.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/widgets/text/e-reflow.c b/widgets/text/e-reflow.c
index 3e062f0f93..4974fd8f04 100644
--- a/widgets/text/e-reflow.c
+++ b/widgets/text/e-reflow.c
@@ -43,7 +43,7 @@ static void e_reflow_unrealize (GnomeCanvasItem *item);
static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
gint x, gint y, gint width, gint height);
static void e_reflow_update (GnomeCanvasItem *item, gdouble affine[6], ArtSVP *clip_path, gint flags);
-static gdouble e_reflow_point (GnomeCanvasItem *item, gdouble x, gdouble y, gint cx, gint cy, GnomeCanvasItem **actual_item);
+static GnomeCanvasItem *e_reflow_point (GnomeCanvasItem *item, gdouble x, gdouble y, gint cx, gint cy);
static void e_reflow_reflow (GnomeCanvasItem *item, gint flags);
static void set_empty (EReflow *reflow);
@@ -1347,22 +1347,16 @@ e_reflow_update (GnomeCanvasItem *item, gdouble affine[6], ArtSVP *clip_path, gi
}
}
-static double
+static GnomeCanvasItem *
e_reflow_point (GnomeCanvasItem *item,
- gdouble x, gdouble y, gint cx, gint cy,
- GnomeCanvasItem **actual_item)
+ gdouble x, gdouble y, gint cx, gint cy)
{
- gdouble distance = 1;
-
- *actual_item = NULL;
+ GnomeCanvasItem *child;
if (GNOME_CANVAS_ITEM_CLASS (e_reflow_parent_class)->point)
- distance = GNOME_CANVAS_ITEM_CLASS (e_reflow_parent_class)->point (item, x, y, cx, cy, actual_item);
- if ((gint) (distance * item->canvas->pixels_per_unit + 0.5) <= 0 && *actual_item)
- return distance;
+ child = GNOME_CANVAS_ITEM_CLASS (e_reflow_parent_class)->point (item, x, y, cx, cy);
- *actual_item = item;
- return 0;
+ return child ? child : item;
#if 0
if (y >= E_REFLOW_BORDER_WIDTH && y <= reflow->height - E_REFLOW_BORDER_WIDTH) {
gfloat n_x;