Canvas wedging on request_update()

I've got a project (similar to a circuit editor) with a bunch of
subclassed canvas groups doing all the work.  I've got classes for the
object, connection pad, and connecting wire.  The object is a many-child
group containing any number of connection pads.  There's a form of the
object that holds any set of object in it, a container version, which
deals (in a rather funky manner) with actually drawing the connections
between objects.

I have it set up so I can successfully draw the wires between the pads of
the objects, finally.  The problem is when I go ahead and move the objects
around in their container...

As I do so, the pad object gets an _update() call.  This goes and
re-arranges the pad in space after potentially calling my own _resize()
function, in case some of its contents (like the text label) changed size.

The issue is that this is the obvious point at which to try to get the
wires to move around.  Each pad has a pointer to the wire connected to it,
so the obvious conclusion is to simply call
gnome_canvas_item_request_update(pad->wire), right?  Wrong.  As soon as
the object moves a couple pixels (one iteration), the canvas simply ceases
to fully function.  Redraws are fine except for the object in question,
which gets thoroughly mutilated.

So the question is, what's going wrong with this thing?  Is there a reason
I can't call gnome_canvas_item_request_update() from within an _update()
call?  From the gnome-libs code it is clear that it recurses up the parent
chain, which shouldn't be a problem I wouldn't think.  The immediate
parent of the wire is the container that holds the two objects (which in
turn hold the pads that the wire is 'connected' to).

I have traced it to somewhere in the CanvasGroup update method.  When I
remove the parent_class->update() call from my _update() method,
everything proceeds normally, modulo the actual drawing of the wire.

I'll try making the wire a subclass of the line object instead of a group
with the line as a child, since I've decided that in all cases the wire
will be nothing but a single line anyway.

Any thoughts?


         Erik Walthinsen <> - Staff Programmer @ OGI
        Quasar project -
   Video4Linux Two drivers and stuff -
       /  \             SEUL: Simple End-User Linux -
      |    | M E G A           Helping Linux become THE choice
      _\  /_                          for the home or office user

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