Re: quirky realize?



On Dom, 2003-03-09 at 05:56, Ramkumar Chinchani wrote:
I have overridden the realize() function with my own for a widget that I
have written. I am attempting to set the event mask within this funtion as
follows.

<< code start >>

void
wm_root_realize(GtkWidget *widget)
{
      WmRoot *wm_root;

      printf("realize\n");

      g_return_if_fail(widget != NULL);
      g_return_if_fail(IS_WM_ROOT(widget));

      GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);

      wm_root = WM_ROOT(widget);

      widget->window = gdk_get_default_root_window();

      gtk_widget_set_events(widget, gtk_widget_get_events(widget) |
GDK_BUTTON_PRESS_MASK);

      g_object_ref(gdk_get_default_root_window());

      gdk_window_set_user_data(widget->window, widget);

      return;
}

<< code end >>

It fails with this message:

Gtk-CRITICAL **: file gtkwidget.c: line 4877 (gtk_widget_set_events):
assertion `!GTK_WIDGET_REALIZED (widget)' failed

GTK_WIDGET_REALIZED just seems to check the flags field, which I have set
to GTK_REALIZED already.

Why is this failing?

  It's obvious :) You must be missing the little '!' that appears here:
assertion `!GTK_WIDGET_REALIZED (widget)' failed

You cannot add events to the event mask of an already realized widget.
And what is it that you are doing? Changing widget's window to a
reference to the root window? Is that necessary? Is that wise? :)


Thanks

-Ram

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
-- 
Gustavo João Alves Marques Carneiro
<gjc inescporto pt> <gustavo users sourceforge net>





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