changeset 30243:658e8b9522bc

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.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 05 Jul 2010 04:44:52 +0000
parents cfdd4d3ba550
children 514ed776e193
files finch/libgnt/gntcombobox.c
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntcombobox.c	Mon Jul 05 03:07:37 2010 +0000
+++ b/finch/libgnt/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;