Calling get/set_events() after realizing?




Is there any reason gtk_widget_get/set_events() can't be called after
a widget is realized? E.g. using code like this:

gint
gtk_widget_get_events (GtkWidget *widget)
{
  gint *events;
  
  g_return_val_if_fail (widget != NULL, 0);
  
  if (GTK_WIDGET_REALIZED (widget))
    return gdk_window_get_events(widget->window);
...


void
gtk_widget_set_events (GtkWidget *widget,
		       gint	  events)
{
  gint *eventp;
  
  g_return_if_fail (widget != NULL);
  g_return_if_fail (!GTK_WIDGET_NO_WINDOW (widget));
  
  if (GTK_WIDGET_REALIZED (widget))
    gdk_window_set_events(widget->window, events);
...


It would get rid of one of the annoying stumbling blocks for learners
of GTK, though I suppose there may be a performance penalty.

It might even be useful for GUI builders at some point.


Damon



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