Widget parenting



Hi all,
    I'm looking for the part of the widget parenting process that allows
the child widget's window to recieve events.

Actualy, this is my problem, I have a test layout like so:

        +-------------------------------+
        |          GtkVBox              |
        |+-----------------------------+|
        ||         MyWidget            ||
        ||                             ||
        ||                             ||
        ||                             ||
        |+-----------------------------+|
        |+-----------------------------+|
        ||         GtkButton           ||
        |+-----------------------------+|
        +-------------------------------+

Where `MyWidget' is my custom creation, it doesn't recieve any expose
events (or any events for that matter) untill either
   A.) I resize the GtkVBox
   B.) I push the GtkButton in the GtkVBox
and then everything works fine.

My realize method is very simple, I setup the GdkWindowAttr and
attribut mask like so:
/********************************************************/
    attributes.window_type = GDK_WINDOW_CHILD;
    attributes.x           = widget->allocation.x;
    attributes.y           = widget->allocation.y;
    attributes.width       = widget->allocation.width;
    attributes.height      = widget->allocation.height;
    attributes.wclass      = GDK_INPUT_OUTPUT;
    attributes.visual      = gtk_widget_get_visual(widget);
    attributes.colormap    = gtk_widget_get_colormap(widget);
    attributes.event_mask  = gtk_widget_get_events(widget);
    attributes.event_mask |= (GDK_EXPOSURE_MASK     |
                              GDK_ENTER_NOTIFY_MASK |
                              GDK_LEAVE_NOTIFY_MASK |
                              GDK_BUTTON_PRESS_MASK |
                              GDK_BUTTON_RELEASE_MASK);
    attributes_mask        = GDK_WA_X | GDK_WA_Y |
                             GDK_WA_VISUAL | GDK_WA_COLORMAP;
/********************************************************/
and then call gdk_window_new() and gdk_window_set_user_data()
(and then I go on to initialize some internals which weren't
possible without a proper GdkDrawable)

I am sure the problem is not there however.

If anyone is aquainted with this type of glitch, I would appriciate any
pointers you could give me ;-)


Cheers,
                                     -Tristan




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