>I have an application in which I'd like to setup global key bindings, >for instance to associate a given key with a previously recorded macro. > >So far, this is not too difficult, since I just have to setup a >"key_press_event" handler on the toplevel window, and then I can do what >I want. > >However, the keys won't work in the dialogs for instance. I haven't >found a way to detect the opening of the dialog, and therefore I can't >setup the handler for key_press_event in that specific toplevel window. > >Is there: > - a way to detect the creation of a GtkWindow or GtkDialog ?
not generically, no. what i do to handle such things is to add a handler for the map_event of new top-level windows. since your code creates them all (i hope!), it can attach to the signal. > - another way to setup global key bindings ? what you're doing sounds right for most applications. there is another way that is very similar: install a key-snooper, which gets to peek at key events before they enter the rest of the GTK+ event system. you get to see them before they are distributed to specific windows that way. this is what my code does. the major problem with it is that you have to keep track of times when you want key events to always flow through GTK+, such as when a user is entering text into an entry widget. this requires handling focus_in and focus_out events from all such widgets, and returning FALSE from the snooper while in them. --p _______________________________________________ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
