Re: difference between event and signal



frederico schardong <frede sch gmail com> writes:

> I'm confusing about the difference between event and signal.

According to the GTK+ FAQ:

First of all, Havoc Pennington gives a rather complete
description of the differences between events and signals in his
free book (two chapters can be found at
http://www106.pair.com/rhp/sample_chapters.html).

Moreover, Havoc posted this to the gtk-list "Events are a stream
of messages received from the X server. They drive the Gtk main
loop; which more or less amounts to "wait for events, process
them" (not exactly, it is really more general than that and can
wait on many different input streams at once). Events are a
Gdk/Xlib concept."

"Signals are a feature of GtkObject and its subclasses. They have
nothing to do with any input stream; really a signal is just a
way to keep a list of callbacks around and invoke them ("emit"
the signal). There are lots of details and extra features of
course. Signals are emitted by object instances, and are entirely
unrelated to the Gtk main loop. Conventionally, signals are
emitted "when something changes" about the object emitting the
signal."

"Signals and events only come together because GtkWidget happens
to emit signals when it gets events. This is purely a
convenience, so you can connect callbacks to be invoked when a
particular widget receives a particular event. There is nothing
about this that makes signals and events inherently related
concepts, any more than emitting a signal when you click a button
makes button clicking and signals related concepts."

-- 
"Now I have to go wash my mind out with soap."
--Derick Siddoway



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