Re: gtk_input_add



Hi,

Nicolas web <cerebro101 yahoo com> writes:

> Hi. I need help to work with sockets. I have a socket
> descriptor and I want to run my function when it has
> data.
> I use this command:
> gdk_input_add (mysocket, GDK_INPUT_READ,
> GTK_SIGNAL_FUNC (myfunction),&mydata)
> I´ve not compiling error. But when data arrives my
> program crashes.
> Function works OK, because it works if assign it to a
> button´s succes.
> I think there´s an error on third argument. Maybe
> GTK_SIGNAL_FUNC () is not correct. Can anybody help me?

did you look at the headers or the API reference?  Apparently not,
since gdk_input_add is defined as

  gint gdk_input_add (gint               source,
                      GdkInputCondition  condition,
                      GdkInputFunction   function,
                      gpointer           data);

where GdkInputFunction has the signature:

  void (*GdkInputFunction) (gpointer           data,
                            gint               source,
                            GdkInputCondition  condition);

so you can't use the same function as you would use for a button
clicked(?) callback and if you do it is no surprise it crashes.


Salut, Sven



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