Re: [gtk-list] Visibility Event Confusion




You are making this a lot harder than it needs to be. :-)

For an event signal, the second argument passed to the signal handler
is a pointer the event structure, in this case the GdkEventVisibility
structure.

Generally, the only people that need to deal with 
the GtkArg structures and signal marshallers are people
writing language bindings.

If you are really curious, you can find out that
the event structure is passed as GDK_TYPE_GDK_EVENT
internally; to quote gtkwidget.c:

  widget_signals[VISIBILITY_NOTIFY_EVENT] =
    gtk_signal_new ("visibility_notify_event",
		    GTK_RUN_LAST,
		    object_class->type,
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, visibility_notify_event),
		    gtk_marshal_BOOL__POINTER,
		    GTK_TYPE_BOOL, 1,
		    GTK_TYPE_GDK_EVENT);

But that's not a level of detail that application writers
typically need to worry about. By the time your signal
handler gets called, things have been translated back
to standard C types.

Regards,
                                        Owen

gouldtj@RoseVC.Rose-Hulman.Edu writes:

> Okay, I am trying to get all of the information that is located in a
> GdkEvent structure when my window gets a visibility event.  I am getting
> the visiblity event, but I can't find the data that I need.
> 
> The feild that I need in the struct GdkEventVisibility is the
> GdkVisibilityState.  I think that I understand that the event is going
> to my gtk_main loop and it goes down to the object level and
> then calling my handler using gtk_BOOL__POINTER().  Which to me
> means that I will be getting some sort of pointer to my function
> besides my data and the widget, that is cool.
> 
> When I lough the code it looks like the data that is going in
> there is the first GtkArg array, which is built in
> gtk_signal_emit(), which I don't understand.  From what I can tell from
> a GtkArg structure is that it can only have standard data types, and not
> something like a GdkEventVisiblity.  So that is confusing.  So I went
> into GDB to look at what I am getting passed  function, and here
> is what I got:
> 
> Breakpoint 1, fl_onscreen_vis_change (widget=0x80ab3c8, args=0x80a8c68, 
> a=0x0) at onscreen.c:99
> 99              printf("fl_onscreen_viz_change\n") bt
> #0  fl_onscreen_vis_change (widget=0x80ab3c8, args=0x80a8c68, data=0 at
> onscreen.c:99
> #1  0x401ded69 in gtk_marshal_BOOL__POINTER ()
> #2  0x4020cbed in gtk_handlers_run ()
> #3  0x4020c032 in gtk_signal_real_emit ()
> #4  0x4020a185 in gtk_signal_emit ()
> #5  0x4023f75c in gtk_widget_event ()
> #6  0ba in gtk_main_do_event ()
> #7  0x402895cb in gdk_event_dispatch ()
> #8  0x6 in g_main_dispatch ()
> #9  0x403a41a1 in g_main_iterate ()
> #10 0x403a4341main_run ()
> #11 0x401dd859 in gtk_main ()
> #12 0x804abe5 in main ()
> #13 0x403eecb3 in start_main (main=0x804a9d0 <main>, argc=1, 
>     argv=0xbffffc14, init=0x8<_init>, fini=0x804cbcc <_fini>, 
>     rtld_fini=0x4000a350 <_dl_fini>, st=0xbffffc0c)
>     at ../sysdeps/generic/libc-start.c:78
> (gdb) display *args
> 1: *args = {type = 29, name = 0x80ab460 "\n\b6*@1", d = {
>     char_dat\000', uchar_data = 0 '\000', bool_data = 655360, 
>     int_data = 655360,ata = 655360, long_data = 655360, 
>     ulong_data = 655360, float_data = 962e-40, 
>     double_data = 3.2379086165851934e-318, 
>     string_data = 0<Address 0xa0000 out of bounds>, 
>     pointer_data = 0xa0000, object_data 000, signal_data = {f =
> 0xa0000, 
>       d = 0x0}, args_data = {n_args = 655360, args = 0x0}, callback_data
> = {
>       marshal = 0xa0000, data = 0x0, notify = 0xc8}, c_callback_data = {
>       func = 0xa0000, func_data = 0x0}, foreign_data = {data = 0xa0000, 
>       notify = 0}}}
> (gdb)
> 
> It looks to me from this that I am infact nong a GtkArg passed
> into my function, but I don't know what I have then...
> 
> The only value that makes sense (and I get consistantly) is the type =
> 29, which doesn't look like an GtkArg type, and doesn't look like a
> GdkVisibiltyState type, so I don't know what type it could be.
> 
> So, thank you for your help.  All I really want is the
> GdkVisibiltyState, if there itter way to get that please tell me,
> I could be going about this all wrong.



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