On Sun, Oct 16, 2011 at 4:47 PM, Kjell Ahlstedt <kjell ahlstedt bredband net> wrote: > >> Searching a bit, I found these: >> >> http://faq.pygtk.org/index.py?file=faq03.011.htp&req=show >> http://www.gtk.org/tutorial1.2/gtk_tut-18.html >> >> The python one says that the keyboard events work differently than >> what I've thought... > > You have found an old version of the gtk+ tutorial. There's a newer one > at http://developer.gnome.org/gtk-tutorial/unstable/. But I don't think > the section on event propagation has been updated. > > Two things surprise me with these descriptions: > > 1. It's said that all event signal handlers, connected to a certain > widget, are called, regardless of the return values of previously called > signal handlers on that widget. This contradicts what is said in the > gtkmm tutorial, the "X Event signals" section. > I just did a little test, and it confirmed what is said on the "X Event signals", when you return true (canceling the event), nothing else is called, even if it is a function handler of the same widget. > 2. An unhandled event signal is said to be propagated to the parent > widget, apparently (although not explicitly stated) even if the parent > widget has no GdkWindow of its own. Elsewhere it's said that only > widgets with a GdkWindow receive event signals. > See e.g. the gtkmm tutorial, the "Widgets Without X-Windows" section. It > talks about X-Windows rather than GdkWindows, but unless I have > misunderstood something, these kinds of windows are equivalent, at least > as far as event signals are concerned. > I tried changing the Gtk::Grid for a Gtk::Box (which is on the list there), and it still received the event. To be honest, I don't really understand that chapter. > In your example code you let the key_release_event signal propagate from > the Gtk::Entry to the EventPropagation window, and not to the Entry's > parent, the Gtk::Grid. Isn't that because the Grid (which has no > Gdk::Window) does not receive the key_release_event signal? > If I add a function for the Grid, it receives the event through event propagation (see the attachment). >> > gtkmm-tutorial-in.xml is a DocBook file. > >> That sure is a big file :) >> Ok, I'll look into it later. >> > We can divide the work between us: > - You fix the formatting of the source code. > - I insert your description into gtkmm-tutorial-in.xml, perhaps with > some modifications. > Ok, thanks. >> If you could help with improving the description, I have some >> difficulty in writing proper english :) >> > English is not my native language. I will probably also make mistakes > that irritate native speakers of English. But I can do my best, and then > hopefully someone else will comment on our text. > Ok, lets do that then. > Kjell > > >
Attachment:
eventPropagation.zip
Description: Zip archive