GNOME Bugzilla – Bug 433593
No keybindings to hide GtkComboBox popup window
Last modified: 2007-05-18 11:33:41 UTC
Right now the key combinations to hide the popup menu are either dependent from GtkMenuShell (in menu mode), or hardcoded in the treeview key-press-event handler (list mode), I'm attaching a patch to add such keybindings to GtkComboBox, and make the menu widgets forward the GdkEventKey to the combobox if they didn't handle it.
Created attachment 87062 [details] [review] patch
The idea looks fine to me. Out of interest, do you envision using anything besides Up/Escape for popdown ? But it appears that the "incredibly lame hack" has been lost ? - /* reset active item -- this is incredibly lame and ugly */ - if (gtk_combo_box_get_active_iter (combo_box, &iter)) - gtk_combo_box_set_active_iter (combo_box, &iter);
Forgot to say that this patch is inspired in a maemo change, they use their Menu and Home keys to also popdown the menu, and besides that, I think it makes sense to have customizable keybindings for both popup and popdown. Regarding that hack, I've been testing things and everything seemed to work fine, will investigate a bit more that change and comment here whether it's still necessary or not :)
Can I propose that we just add the hack back for now ?
Yeah, doing that doesn't hurt indeed, but I've checked the source of this hack, and it almost takes me to the beginning of time (it's been there since the first commit in libegg/libegg/combo-old/eggcomboboxpicker.c [1]). I've also asked Kris and he doesn't seem to remember... IMHO there are many chances that the hack isn't needed anymore, after all the heavy code changes. But anyways... will do a new patch with the hack back :) [1] http://svn.gnome.org/viewcvs/libegg/trunk/libegg/combo-old/eggcomboboxpicker.c?revision=176&view=markup
I concur that a lame hack that nobody can remember the reason for is not worth keeping. And I couldn't spot any behaviour difference in some testing. So feel free to rip it out.
Thanks! I've just committed this to trunk :) 2007-05-18 Carlos Garnacho <carlos@imendio.com> Make combobox menu popdown keybindable (#433593) * gtk/gtkcombobox.c (gtk_combo_box_class_init): Add "popdown" binding signal and keybindings. (gtk_combo_box_real_popdown): Added, "popdown" keybinding signal handler. (gtk_combo_box_menu_key_press): (gtk_combo_box_list_key_press): forward the event to the combobox if it wasn't handled by the menu.