On Monday 02 January 2006 16:10, [EMAIL PROTECTED] wrote: > What is the right list, so I can post there?
This is the mailing list for the C++ bindings for GTK+ and glib - it would therefore be relevant if you were inquiring about the Glib::signal_timeout().connect() wrapper function for g_timeout_add(). The gtk-list or gtk-app-devel-list would normally be relevant to using the C API of glib. [snip] > So, I've to understand better the timer... Anyway a last question: > My actual goal is to call a function at an interval, but with > different parameters every interval. Specifically, the parameters are > the time of the last call to the function (or a specfied time) and the > current time (or a specified time). Is it possible with > g_timeout_add?? The third argument of g_timeout_add() binds to the callback (as does for example the fourth argument of g_signal_connect()). The timeout callback works the same way as other glib or GTK+ signal callbacks. It is just a program event for the program event loop. You do not say why you need to store timings, but if that is what you need to do, why don't you generate the timings in the callback itself and store the most recent one in a static variable of function scope? If you are programming in C++ you could alternatively make the callback a friend of a class and store the timings as class data (if the data is not a static class member, you will have to pass the 'this' pointer as the third argument of g_timeout_add() so that you can cast it back to the relevant type in the callback in order to reference the object instance concerned). Although many compilers (such as gcc) in practice allow you to pass a static class member function to a function pointer with C linkage (and GTK+ callbacks have C linkage) thus avoiding the need for a friend function, this is not guaranteed to work by the standard as static class member functions cannot have C linkage (they have C++ linkage) and they are therefore different types. Note that the timeout callback is called from the program event loop so the interval you specify in g_timeout_add() is the earliest (not the latest) that your callback will be called, and depends on what other things the program is doing at the time. The timer does not attempt to "make up" lost time between invocations of the callback. Chris _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
