Re: Enter and leave, but not to child writes:

> Sorry for the slightly offtopic question!
> I am developing an extension to GtkWidget. I have set up event-handlers
> for leave_notify_event and enter_notify_event. These are unfourtunately
> called both when the pointer enters/leaves the widget (MY testwidget is a 
> GtkWindow), and when it enters/leaves a sub-widget (widget contained
> inside the window). As a sidenote, this is, as I can see, not the
> semantics of the enter and leave notify event of the X protocol. How do I
> detect if the leave was to a subwidget's window (and if an enter was from
> such a window), or if it was to (or from) the parent window of the widget?

All GTK+ events are propagated from child to parent if not
handled. (That is, if the event handler does not return TRUE.)

However, the window fields of the event structure are not
modified during propagation.

So, you can do things like:

 GtkWidget *widget;
 gdk_window_get_user_data (crossing_event->window, &widget);
 if (widget == me)
     /* do whatever */
   /* Ignore the event, it was an event in a child window */


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