[gtk+] Add a private function to determine if we simulate



commit 98121aa302e48457791c56abce904f55d20ce7f5
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 31 13:30:05 2015 -0400

    Add a private function to determine if we simulate
    
    These same two or three tests are currently duplicated
    in several places, with separate static variables. Lets
    do this in one place.

 gtk/gtkmain.c    |   11 +++++++++++
 gtk/gtkprivate.h |    2 ++
 2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 6e5188b..5640097 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -811,6 +811,17 @@ gtk_set_debug_flags (guint flags)
   debug_flags = flags;
 }
 
+gboolean
+gtk_simulate_touchscreen (void)
+{
+  static gint test_touchscreen;
+
+  if (test_touchscreen == 0)
+    test_touchscreen = g_getenv ("GTK_TEST_TOUCHSCREEN") != NULL ? 1 : -1;
+
+  return test_touchscreen > 0 || (debug_flags & GTK_DEBUG_TOUCHSCREEN) != 0;
+ }
+
 /**
  * gtk_get_option_group:
  * @open_default_display: whether to open the default display
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
index 5fe7d88..9385b8b 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -95,6 +95,8 @@ gboolean        _gtk_propagate_captured_event  (GtkWidget       *widget,
 void _gtk_load_dll_with_libgtk3_manifest (const char *dllname);
 #endif
 
+gboolean        gtk_simulate_touchscreen (void);
+
 G_END_DECLS
 
 #endif /* __GTK_PRIVATE_H__ */


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