Re: Having an event box pass unhandled events to its child



Thanks for trying to help. Unfortunately neither gtk_widget_add_events() nor the gtk_widget_event() "trick" is able to solve the problem. Regarding the gtk_widget_add_events(), I added a call to

    gtk_widget_add_events(w_fs_button, GDK_ALL_EVENTS_MASK);

to m the program from my previous email, but didn't make any difference. The following call is still ignored/blocked:

    g_signal_connect(w_fs_button, "button-press-event",
                     G_CALLBACK(cb_button_press_event), NULL);

Trying to proxy events by using a gtk_event_box() doesn't work either.

Is there no "strace" like system in gobject that makes it possible to dump all signals that are being sent in a program? That might help me figuring out what is going wrong.

Regards,
Dov

2009/5/24 Chris Vine <chris cvine freeserve co uk>
On Sun, 24 May 2009 09:24:19 +0300
Dov Grobgeld <dov grobgeld gmail com> wrote:
> In my last email, that unfortunately no one answered, I asked how to
> get right click to work on any widget.  Since I didn't find a
> solution to that I thought to do a work around by putting the widget
> I want to add right-click to into an event box. So I packed my widget
> into an event box and figured out that I need to put the eventbox
> "above" in order to catch all the events. That all works find and I
> can now catch right click and any other event in the eventbox. But I
> was then stuck on how to get the eventbox to pass on events that it
> does not want to handle into its child widget. This is against normal
> gtk behaviour that only passes events from a child to a parent, and
> not the other way around. I realize that if I manage to pass an event
> from the parent eventbox to the child, I will have to make some
> mechanism to break recursion so that the child will pass on the event
> to the parent that passes the event to the child, ad out-of-memory
> crash.

You can pass on a current (real) event with gtk_widget_event(), but
there is almost certainly something wrong with your code.  Using
gtk_widget_event() for this purpose will in effect pass the
event from one GdkWindow object to another GdkWindow object, when that
other one, because it is the window of a widget which you say is a child
of the one passing it on, is fully capable of receiving it by itself in
the first place.  gtk_widget_event() can be useful in certain limited
cases to pass events to widgets which are not direct children of the
recipient (I have used it to pass on keyboard events to a GtkTextView
object), but inserting a widget which already has a GdkWindow in an
additional event box is not going to change things.

GtkEventBox is for objects which do not have their own GdkWindow, but
almost all widgets do (GtkLabel being an exception). Possibly you
needed to add the relevant event to the event mask of the widget
concerned with gtk_widget_add_events().

You probably need to find out what is wrong with your code in the
first place.

Chris




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