qulogic/libgnt

Make the combobox a bit more friendly.

2010-07-05, Sadrul Habib Chowdhury
47a58a8fcb6e
Parents 4678d2312559
Children 9bc45b55447d
Make the combobox a bit more friendly.

While the dropdown in the combobox is not shown, and some key is pressed
that triggers an action in the dropdown (e.g. home, end keys etc.), popup
the dropdown.
--- a/gntcombobox.c Sun Jul 04 02:12:51 2010 +0000
+++ b/gntcombobox.c Mon Jul 05 04:44:52 2010 +0000
@@ -150,12 +150,9 @@
gnt_combo_box_key_pressed(GntWidget *widget, const char *text)
{
GntComboBox *box = GNT_COMBO_BOX(widget);
- if (GNT_WIDGET_IS_FLAG_SET(box->dropdown->parent, GNT_WIDGET_MAPPED))
- {
- if (text[1] == 0)
- {
- switch (text[0])
- {
+ if (GNT_WIDGET_IS_FLAG_SET(box->dropdown->parent, GNT_WIDGET_MAPPED)) {
+ if (text[1] == 0) {
+ switch (text[0]) {
case '\r':
case '\t':
case '\n':
@@ -166,8 +163,12 @@
return TRUE;
}
}
- if (gnt_widget_key_pressed(box->dropdown, text))
- return TRUE;
+ }
+
+ if (gnt_widget_key_pressed(box->dropdown, text)) {
+ if (!GNT_WIDGET_IS_FLAG_SET(box->dropdown->parent, GNT_WIDGET_MAPPED))
+ popup_dropdown(box);
+ return TRUE;
}
return FALSE;