diff src/evdev-plug/ed_ui.c @ 1055:0cc6b35fbeb4 trunk

[svn] - evdev-plug 0.2: do not intercept all event types, currently only pick types KEY and ABSOLUTE; there could be other event types that are worth intercepting, feedback needed about this
author giacomo
date Tue, 22 May 2007 05:24:09 -0700
parents d124034ebea3
children 96cc46b1cf5e
line wrap: on
line diff
--- a/src/evdev-plug/ed_ui.c	Tue May 22 02:28:58 2007 -0700
+++ b/src/evdev-plug/ed_ui.c	Tue May 22 05:24:09 2007 -0700
@@ -771,14 +771,24 @@
         }
         else
         {
-          /* the trigger-dialog window is open; record input and
-             store it in a container managed by the trigger-dialog itself */
-          ed_inputevent_t *dinputev = g_malloc(sizeof(ed_inputevent_t*));
-          dinputev->type = inputev.type;
-          dinputev->code = inputev.code;
-          dinputev->value = inputev.value;
-          g_object_set_data( G_OBJECT(trigger_dlg) , "trigger-data" , dinputev );
-          gtk_dialog_response( GTK_DIALOG(trigger_dlg) , GTK_RESPONSE_OK );
+          /* currently, only care about events of type 'key' and 'absolute'
+             TODO: should we handle some other event type as well? */
+          switch ( inputev.type )
+          {
+            case EV_KEY:
+            case EV_ABS:
+            {
+              /* the trigger-dialog window is open; record input and
+               store it in a container managed by the trigger-dialog itself */
+              ed_inputevent_t *dinputev = g_malloc(sizeof(ed_inputevent_t*));
+              dinputev->type = inputev.type;
+              dinputev->code = inputev.code;
+              dinputev->value = inputev.value;
+              g_object_set_data( G_OBJECT(trigger_dlg) , "trigger-data" , dinputev );
+              gtk_dialog_response( GTK_DIALOG(trigger_dlg) , GTK_RESPONSE_OK );
+              break;
+            }
+          }
         }
       }
     }