From: compudj Date: Wed, 7 Sep 2005 19:53:44 +0000 (+0000) Subject: add enter to input field X-Git-Tag: v0.12.20~2342 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=3cea5310be1c058050896507483df2ddf5ee4970;p=lttv.git add enter to input field git-svn-id: http://ltt.polymtl.ca/svn@1147 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/modules/gui/filter/filter.c b/ltt/branches/poly/lttv/modules/gui/filter/filter.c index 881c5365..90de72ee 100644 --- a/ltt/branches/poly/lttv/modules/gui/filter/filter.c +++ b/ltt/branches/poly/lttv/modules/gui/filter/filter.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -72,6 +73,9 @@ void filter_destroy_walk(gpointer data, gpointer user_data); * Callback functions */ void callback_process_button(GtkWidget *widget, gpointer data); +gboolean callback_enter_check(GtkWidget *widget, + GdkEventKey *event, + gpointer user_data); void callback_add_button(GtkWidget *widget, gpointer data); void callback_logical_op_box(GtkWidget *widget, gpointer data); void callback_expression_field(GtkWidget *widget, gpointer data); @@ -230,6 +234,8 @@ gui_filter(Tab *tab) * - processing button */ fvd->f_expression_field = gtk_entry_new(); //gtk_scrolled_window_new (NULL, NULL); + g_signal_connect (G_OBJECT(fvd->f_expression_field), + "key-press-event", G_CALLBACK (callback_enter_check), (gpointer)fvd); // gtk_entry_set_text(GTK_ENTRY(fvd->f_expression_field),"state.cpu>0"); gtk_widget_show (fvd->f_expression_field); @@ -537,6 +543,24 @@ callback_process_button(GtkWidget *widget, gpointer data) { lttvwindow_report_filter(fvd->tab, filter); } +gboolean callback_enter_check(GtkWidget *widget, + GdkEventKey *event, + gpointer user_data) +{ + g_debug("typed : %x", event->keyval); + switch(event->keyval) { + case GDK_Return: + case GDK_KP_Enter: + case GDK_ISO_Enter: + case GDK_3270_Enter: + callback_expression_field(widget, user_data); + break; + default: + break; + } + return FALSE; +} + /** * @fn void callback_expression_field(GtkWidget*,gpointer) *