After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 115689 - gnome_canvas_item_lower() does not allow relative positioning easily enough
gnome_canvas_item_lower() does not allow relative positioning easily enough
Status: RESOLVED WONTFIX
Product: libgnomecanvas
Classification: Deprecated
Component: core
2.2.x
Other Linux
: High enhancement
: ---
Assigned To: libgnomecanvas maintainers
Federico Mena Quintero
gnome[unmaintained]
Depends on:
Blocks:
 
 
Reported: 2003-06-21 20:23 UTC by John Heidemann
Modified: 2014-08-02 12:52 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description John Heidemann 2003-06-21 20:23:22 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;
	};

}
Comment 1 Kjartan Maraas 2004-01-20 13:50:51 UTC
Could someone look at this patch and see if it's ok?
Comment 2 Luis Villa 2004-02-14 05:20:18 UTC
John- I'd suggest emailing federico directly, he does not regularly
look at gnomecanvas bugzilla, unfortunately.
Comment 3 John Heidemann 2004-02-14 18:12:16 UTC
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.
Comment 4 Kjartan Maraas 2004-03-29 10:31:00 UTC
Did you get a response from Federico on this issue?
Comment 5 John Heidemann 2004-03-29 17:54:27 UTC
no
Comment 6 André Klapper 2014-08-02 12:52:41 UTC
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