gdk_input_add() with class member as callback problem



Hi,

I'm stuck with the gdk_input_add() function and could use a hint to solve the 
problem. So here goes;

The callback function I want to call is a member of a class, but g++ won't 
compile this. Placing the function outside the class works, but this is not 
the solution I'm looking for.

The code:

InputLirc :: InputLirc()
{
 ...

 tag = gdk_input_add( sock,
     GDK_INPUT_READ,
     &InputLirc::ProcessLircInput,
     NULL );

 ...
}

void InputLirc :: ProcessLircInput( gpointer data, gint source, 
GdkInputCondition condition )
{
 ...
}

The compile error:

input_lirc.cpp: In constructor `InputLirc::InputLirc()':
input_lirc.cpp:73: error: cannot convert `void (InputLirc::*)(void*, int,
   GdkInputCondition)' to `void (*)(void*, int, GdkInputCondition)' for
   argument `3' to `gint gdk_input_add(int, GdkInputCondition, void (*)(void*,
   int, GdkInputCondition), void*)'

Or this one (when removing the &):

input_lirc.cpp: In constructor `InputLirc::InputLirc()':
input_lirc.cpp:73: error: no matches converting function `ProcessLircInput' to
   type `void (*)(void*, int, enum GdkInputCondition)'
input_lirc.h:63: error: candidates are: void 
InputLirc::ProcessLircInput(void*,
   int, GdkInputCondition)


The solution is probably simple, but I just can't seem to figure it out.... 
Any help would be appreciated!



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