Re: Signals in Gtk+




Sascha Ziemann <szi@aibon.ping.de> writes:

> Hi,
> 
> I wrote some code to get reliable timers. The code works fine and I
> am able to play video streams with up to 100 Hz (as long as I ignore
> the fact that my monitor does not run with 100 Hz). Now I want to
> create a GtkTimer widget. Therefore I tried to map the timer events to
> Gtk signals. But it seems to me that this does not work. When I define
> a new signal for GtkObject, for example "timer", I can connect
> different callbacks to the "timer" signal for different widgets. But
> the timers are not all the same, because each timer can run with a
> different frequency. Timer A for example runs with 40 Hz and timer B
> with 50 Hz. In order to avoid sending timer A signals to widget B,
> which wants only timer B signals, I would have to define two different
> signals: one for timer A and one for timer B. This would be OK for two
> timers but not for a unknown number of timers. In order to solve this,
> I need attributed signals. By this a widget would be able to say "yes
> I want the timer signal, but only those running with 40 Hz". I think
> with the current Gtk+ this is not possible. Is this right?

Why not:

 gtk_signal_connect (GTK_OBJECT (forty_hz_timer), "expired",
                     callback1, widget_a);

 gtk_signal_connect (GTK_OBJECT (fifty_hz_timer), "expired",
                     callback2, widget_b);

Or are you saying you want a single object to generate both
40Hz and 50Hz signals?

Regards,
                                        Owen



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