Non-filled polygons don't get any CanvasItem events



According to a comment in gnome-canvas-polygon.h:

/* Polygon item for the canvas.  A polygon is a bit different from rectangles and ellipses in that
 * points inside it will always be considered "inside", even if the fill color is not set.  If you
 * want to have a hollow polygon, use a line item instead.
 */

and also based on how the GNOME1 version used to work, I don't understand
why the following code doesn't call canvas_event_cb when e.g. mousing over
the item, unless the #ifdef is set to 1:


    GnomeCanvasPoints *points = gnome_canvas_points_new (4);

#define SET_COORD(points, idx, x, y) points->coords[((idx) * 2)] = x; points->coords[((idx) * 2) + 1] = y;
    SET_COORD(points, 0, 0, 0);
    SET_COORD(points, 1, 50, 0);
    SET_COORD(points, 2, 50, 50);
    SET_COORD(points, 3, 0, 50);
#undef SET_COORD
   
    GnomeCanvasItem *item = gnome_canvas_item_new (c.root ()->gobj (), gnome_canvas_polygon_get_type (),
						   "points", points, 
						   "width_pixels", 2,
						   "outline_color", "black",
#if 0
						   "fill_color", "red",
#endif
						   0);

    g_signal_connect (G_OBJECT (item), "event", G_CALLBACK (canvas_event_cb), 0);
    

-- 
   .--= ULLA! =---------------------.   `We are not here to give users what
   \     http://cactus.rulez.org     \   they want'  -- RMS, at GUADEC 2001
    `---= cactus cactus rulez org =---'
'Bother!' said Pooh, as Cthulhu rose and ate him.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]