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 /widgets/text/e-text.c | |
parent | 08e71ba8ae72f333f017c25168b9ec85ea5954fa (diff) | |
download | gsoc2013-evolution-b3a95d0299386bccbdebb967d15f4df02cf15891.tar.gz 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-text.c')
-rw-r--r-- | widgets/text/e-text.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index 378a8dfc0e..e58d5bf8a2 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -1620,9 +1620,9 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, } /* Point handler for the text item */ -static double +static GnomeCanvasItem * e_text_point (GnomeCanvasItem *item, gdouble x, gdouble y, - gint cx, gint cy, GnomeCanvasItem **actual_item) + gint cx, gint cy) { EText *text; gdouble clip_width; @@ -1630,8 +1630,6 @@ e_text_point (GnomeCanvasItem *item, gdouble x, gdouble y, text = E_TEXT (item); - *actual_item = item; - /* The idea is to build bounding rectangles for each of the lines of * text (clipped by the clipping rectangle, if it is activated) and see * whether the point is inside any of these. If it is, we are done. @@ -1656,17 +1654,17 @@ e_text_point (GnomeCanvasItem *item, gdouble x, gdouble y, cx > text->clip_cx + clip_width || cy < text->clip_cy || cy > text->clip_cy + clip_height) - return 1; + return NULL; if (text->fill_clip_rectangle || !text->text || !*text->text) - return 0; + return item; cx -= text->cx; if (pango_layout_xy_to_index (text->layout, cx, cy, NULL, NULL)) - return 0; + return item; - return 1; + return NULL; } /* Bounds handler for the text item */ |