[gtk+/multitouch: 112/121] entry: Only allow press-and-hold on the text_area window



commit 9bcf127c8718ab4ae67710396cfcbc1993d853b8
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jan 12 02:38:17 2012 +0100

    entry: Only allow press-and-hold on the text_area window
    
    This avoids oddities in spinbuttons, press-and-hold shouldn't
    be triggered on the buttons.

 gtk/gtkentry.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 5f651eb..d8c07c1 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -8845,6 +8845,20 @@ gtk_entry_press_and_hold (GtkWidget             *widget,
   if (action == GTK_PRESS_AND_HOLD_TRIGGER)
     gtk_entry_do_popup (GTK_ENTRY (widget),
                         device, GDK_CURRENT_TIME, 1);
+  else if (action == GTK_PRESS_AND_HOLD_QUERY)
+    {
+      GtkEntryPrivate *priv;
+      GdkEvent *event;
+
+      priv = GTK_ENTRY (widget)->priv;
+      event = gtk_get_current_event ();
+
+      if (!event ||
+          (event->type != GDK_BUTTON_PRESS &&
+           event->type != GDK_TOUCH_PRESS) ||
+          event->button.window != priv->text_area)
+        return FALSE;
+    }
 
   return TRUE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]