r3151 - in trunk/src/target/OM-2007.2/applications/openmoko-dialer2: . src

thomas at sita.openmoko.org thomas at sita.openmoko.org
Fri Oct 12 14:57:49 CEST 2007


Author: thomas
Date: 2007-10-12 14:57:47 +0200 (Fri, 12 Oct 2007)
New Revision: 3151

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.c
Log:
* src/moko-keypad.c: Clear dialer display when delete button held down,
rather than only when held and released


Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2007-10-12 11:12:56 UTC (rev 3150)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2007-10-12 12:57:47 UTC (rev 3151)
@@ -1,5 +1,10 @@
 2007-10-12  Thomas Wood  <thomas at openedhand.com>
 
+	* src/moko-keypad.c: Clear dialer display when delete button held down,
+	rather than only when held and released
+
+2007-10-12  Thomas Wood  <thomas at openedhand.com>
+
 	* src/moko-dialer-panel.c: (moko_dialer_panel_init):
 	* src/moko-keypad.c: (on_panel_user_hold):
 

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.c	2007-10-12 11:12:56 UTC (rev 3150)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.c	2007-10-12 12:57:47 UTC (rev 3151)
@@ -173,40 +173,36 @@
 }
 
 static gboolean
+moko_keypad_hold_timeout (MokoDialerTextview *textview)
+{
+  moko_dialer_textview_empty (textview);
+  return FALSE;
+}
+
+static gboolean
 on_delete_event (GtkWidget *button, GdkEventButton *event, MokoKeypad *keypad)
 {
-#define TAP_HOLD_TIME 800
   MokoKeypadPrivate *priv;
   MokoDialerTextview *textview;
-  static guint32 last_event = 0;
   GList *matches;
-  
+  static gint hold_timeout_source = 0;
+
   g_return_val_if_fail (MOKO_IS_KEYPAD (keypad), FALSE);
   priv = keypad->priv;
-  
+
   textview = MOKO_DIALER_TEXTVIEW (priv->textview);
 
   if (event->type == GDK_BUTTON_PRESS)
   {
-    last_event = event->time;
+    moko_dialer_textview_delete (textview);
+    hold_timeout_source = g_timeout_add (800, (GSourceFunc) moko_keypad_hold_timeout, textview);
     return FALSE;
   }
   else if (event->type == GDK_BUTTON_RELEASE)
   {
-    guint32 diff = event->time - last_event;
-
-    if (diff < TAP_HOLD_TIME)
-    {
-      /* Normal 'clicked' event */
-      moko_dialer_textview_delete (textview);
-    }
-    else
-    {
-      /* Tap-and-hold event */
-      moko_dialer_textview_empty (textview);
-   }
+    g_source_remove (hold_timeout_source);
   }
-  
+
   if (!priv->pin_mode)
   {
     /* Some autocomplete stuff */





More information about the commitlog mailing list