Re: Signal handling questions

A nice way to do it would be to subclass your widget and chain up to
the parent expose
method where needed.

if you need to draw generically on widgets, it wont work for all
widgets (some widgets
can have floating subwindows)... but you can be bold and connect to
the "event" signal
and do something like:

if (event_type == GDK_EXPOSE)
    g_signal_emit_by_name (widget, "expose-event", event, &retval);
    do_my_overlay_drawing (widget);

    return TRUE;
 return FALSE;

On Tue, Aug 17, 2010 at 1:51 AM, Dov Grobgeld <dov grobgeld gmail com> wrote:
> While playing around with a general system for doing polygon overlays (e.g.
> for rectangle or line selection) I got stuck on the following problem.
> Assume that I have a widget A that has an expose handler exp_A().
> Now assume that I would temporarily like to draw an "overlay on A" from the
> code in expose handler exp_B(). I.e. after exp_A() has finished its work,
> exp_B() should be called.
> I am in control of exp_B() but cannot touch exp_A().
> I trigger the calling of expose events by calling
> gdk_window_invalidate_rect() from update_B().
> The problem is as follows:
> If I do g_signal_connect_after(widget, "expose-event", exp_B, me) then I set
> up the correct order of exposure through A and B, but if exp_A() does
> "return TRUE", then exp_B() will not be called.
> If I do g_signal_connect(widget, "expose-event", exp_B, me) then exp_B()
> will always be called, but in the wrong order.
> So how is can this be solved?
> If I do g_signal_connect(), can exp_B() e.g. block itself as a signal
> handler and rethrow() the signal to the other handlers and then return? How
> is this done?
> Thanks!
> Dov
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org

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