[gtk+] entry: Use gtk_simulate_touchscreen



commit 5aa1f0923c467d00a38da17b114c0b3f0bfdbced
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 31 13:44:11 2015 -0400

    entry: Use gtk_simulate_touchscreen
    
    Instead of repeated manual checks.

 gtk/gtkentry.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index dbaee71..a7d04fb 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -336,7 +336,6 @@ enum {
 };
 
 static guint signals[LAST_SIGNAL] = { 0 };
-static gboolean test_touchscreen = FALSE;
 
 typedef enum {
   CURSOR_STANDARD,
@@ -2059,8 +2058,6 @@ gtk_entry_class_init (GtkEntryClass *class)
                                                                GTK_PARAM_READABLE |
                                                                G_PARAM_DEPRECATED));
 
-  test_touchscreen = g_getenv ("GTK_TEST_TOUCHSCREEN") != NULL;
-
   gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ENTRY_ACCESSIBLE);
 }
 
@@ -4466,9 +4463,8 @@ gtk_entry_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
       GdkDevice *source;
 
       source = gdk_event_get_source_device (event);
-      is_touchscreen = test_touchscreen ||
-        (gtk_get_debug_flags () & GTK_DEBUG_TOUCHSCREEN) != 0 ||
-        gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN;
+      is_touchscreen = gtk_simulate_touchscreen () ||
+                       gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN;
 
       if (!is_touchscreen)
         mode = GTK_TEXT_HANDLE_MODE_NONE;
@@ -4758,8 +4754,7 @@ gtk_entry_drag_gesture_update (GtkGestureDrag *gesture,
         gtk_entry_set_positions (entry, tmp_pos, -1);
 
       /* Update touch handles' position */
-      if (test_touchscreen ||
-          (gtk_get_debug_flags () & GTK_DEBUG_TOUCHSCREEN) != 0 ||
+      if (gtk_simulate_touchscreen () ||
           input_source == GDK_SOURCE_TOUCHSCREEN)
         {
           gtk_entry_ensure_text_handles (entry);
@@ -4797,9 +4792,8 @@ gtk_entry_drag_gesture_end (GtkGestureDrag *gesture,
 
   event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
   source = gdk_event_get_source_device (event);
-  is_touchscreen = (test_touchscreen ||
-                    (gtk_get_debug_flags () & GTK_DEBUG_TOUCHSCREEN) != 0 ||
-                    gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN);
+  is_touchscreen = gtk_simulate_touchscreen () ||
+                   gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN;
 
   if (in_drag)
     {


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