diff finch/libgnt/gntcombobox.c @ 30671: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 6943aec8cf61
children e1b511df0d3e
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;