Re: [gtk-list] set_events




> Hi.
> Someone (I don't remeber) disabled the gtk_widget_set_events
> call when the widget is already realized. That's right because
> it wouldn't have any effect, but I think it should be possible
> to change the event_mask of a widget at any time
> (and possibly other GdkWindow attributes as well).
> We need a gdk wrapper for the XChangeWindowAttributes
> (something like gdk_window_change_attributes).
> If there are no objections I can work on this in a few days.

I just wanted to point out that an interface to getting/setting
the event mask already exists:
  
GdkEventMask  gdk_window_get_events      (GdkWindow       *window);
void          gdk_window_set_events      (GdkWindow       *window,
                                          GdkEventMask     event_mask);

The correct way to use these functions is:

 mask = gdk_window_get_events (widget->window);
 mask |= GDK_KEY_PRESS_MASK;
 gdk_window_set_events (widget->window, mask);

Having gtk_widget_set_events work at any time would be nice,
but is not quite so straightforward to implement - widgets
can add to the event mask to a window in their realize() procedure,
so it is impossible to know after the fact what the correct
would be.

So to make it work correctly would require modifying many
widgets. Perhaps by adding a new signal "get_events" and
make gtk_widget_get_events or the result of that onto the
mask set by gtk_widget_set_events.

Regards,
                                        Owen



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