Re: idle function parameters



Hi, 
I have the following function:

int glarea_draw (GtkWidget* widget, GdkEventExpose* event, gpointer id)
{
      if (event->count > 0)
      {
              return(TRUE);
      }       

      if (gtk_gl_area_make_current(GTK_GL_AREA(widget)))
      {
              glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
              glLoadIdentity();
              switch (GPOINTER_TO_INT(id)){
                       do stuff
            }
       }
 }

And I use that:

gtk_idle_add_priority (GTK_PRIORITY_REDRAW,glarea_draw, GINT_TO_POINTER(1));

Did you check the declaration of gtk_idle_add_priority()?
Here it is according to gtk docs:

guint gtk_idle_add_priority( gint priority, GtkFunction function, gpointer data);

where GtkFunction is declared as:

gint (*GtkFunction) (gpointer data).

You glarea_draw is not a GtkFunction, it expects three argumenrs whereas
gtk passes it only the gpointer data as its first argument.

If you need to pass more than one parameter as user_data, use
structures.  You can search the archives about how to pass more than
one parameter. It is a FAQ.




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