add enter to input field
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 7 Sep 2005 19:53:44 +0000 (19:53 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 7 Sep 2005 19:53:44 +0000 (19:53 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1147 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/filter/filter.c

index 881c5365dcfa73766694d3e9834f219b3920fb2b..90de72ee815a73292cb65d1e75ff2346375c5022 100644 (file)
@@ -24,6 +24,7 @@
 #include <string.h>
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
 
 #include <lttv/lttv.h>
 #include <lttv/module.h>
@@ -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)
  * 
This page took 0.024474 seconds and 4 git commands to generate.