Re: children's button and motion events



There is a way to prevent Parents from receiving the button events.
When we register for button-press through
g_signal_connect_closure_by_id(.., .., .., .., .., true/false) API, we
can specify whether we can receive the event 'before' the event
actually occurred, or 'after' the event.
Register two functions for the same (button-press)signal - one for
'before' (specified by the value 'false' in the last argument of above
API) the event....and another for 'after' the event.
Once the event occur - signal is passed 'before' the event is actually
processed by GTK. At this point, your application can do the requried
action in the registered event handler. After you return '0' from this
function, your 2nd event handler function (which is registered for
'after' the event) will be called. Your application code should simply
return '1' in that 2nd function - meaning that, you are done with
processing of the event....thus, GTK will not send any signals
corresponding to that event.

To prevent the mouse motion from receiving on parents - in the
GdkEventCrossing event structure, use the 'subWindow' field. If that
field is non-zero, then the mouse motion is received on the parent,
though the mouse is actually moved on the child widget.

Hope this helps.

On Wed, Apr 29, 2009 at 3:17 PM, Tony Wang <wangtao adi gmail com> wrote:
Hi all,
I do not want parents in the widget tree to see the button and motion events
of the children, how should I do to achieve the goal?
Is it right for just not calling the gtk_propagate_event() function?

TIA,
Tony
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




-- 
Regards,
Praveen



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