GNOME Bugzilla – Bug 115689
gnome_canvas_item_lower() does not allow relative positioning easily enough
Last modified: 2014-08-02 12:52:41 UTC
I posted this question to gnome-devel-list: > I don't understand the ordering commands. > gnome_canvas_item_raise_to_top() and > gnome_canvas_item_lower_to_bottom() are clear and useful, but > gnome_canvas_item_{lower,raise}() are not very useful because they > work in "positions". I don't know the relative positions of objects > (there doesn't seem to be an API to extract your stacking order). An > API where you specify positions relative to some other object would be > much more useful, IMHO. For example, Tk's says "lower item X below > other item Y". > > Should we either export an item's stacking position (to make > gnome_canvas_item_lower useful if painful), or add APIs that allow you > to do relative position? (Perhaps > gtk_canvas_item_lower_relative(GnomeCanvasItem *item_to_lower, > GnomeCanvasItem *superior_item), where after it, item_to_lower is one > stacking step lower than superior_item)? Getting no reply, I went ahead and implemented the function I wanted. I don't see any way to (easily) provide this functionality without access to libgnomecanvas internals, so I'd love to see this code in a future release. -John Heidemann /** * gnome_canvas_item_lower_below: * @item: A canvas item whose stacking order should change. * @superior: The item that will be just above ITEM upon exit. * * Raises the item in the stacking order so that it just just below * superior. **/ void gnome_canvas_item_lower_below(GnomeCanvasItem *item, GnomeCanvasItem *superior) { GList *item_link, *superior_link; GnomeCanvasGroup *parent; g_return_if_fail(GNOME_IS_CANVAS_ITEM(item)); g_return_if_fail(GNOME_IS_CANVAS_ITEM(superior)); if (!item->parent) return; /* not part of a canvas? */ if (!superior->parent) return; /* not part of a canvas? */ g_assert(item->parent != superior->parent); /* can't move between canvases */ parent = GNOME_CANVAS_GROUP(item->parent); item_link = g_list_find(parent->item_list, item); g_assert(item_link != NULL); superior_link = g_list_find(parent->item_list, item); g_assert(superior_link != NULL); /* move it */ if (put_item_after(item_link, superior_link)) { redraw_if_visible(item); item->canvas->need_repick = TRUE; }; }
Could someone look at this patch and see if it's ok?
John- I'd suggest emailing federico directly, he does not regularly look at gnomecanvas bugzilla, unfortunately.
Ok, I'll mail Federico. Looking at my current use of this function, I see I had to comment out the g_assert(item->parent != superior->parent); line.
Did you get a response from Federico on this issue?
no
The last libgnomecanvas code changes took place in January 2011: https://git.gnome.org/browse/archive/libgnomecanvas/log/ This project is not under active development anymore. This project got recently archived in GNOME Git. It is currently unlikely that there will be any further active development. Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect reality. Please feel free to reopen this bug report in the future if anyone takes the responsibility for active development again. If you are interested in maintainership, inform https://mail.gnome.org/mailman/listinfo/desktop-devel-list