[gtk+] tests: Remove gtk_widget_send_key()



commit 2a9ae1e8df5d59140e54d3b05419f27fb2ac7d7b
Author: Benjamin Otte <otte redhat com>
Date:   Sun Jan 8 01:47:51 2017 +0100

    tests: Remove gtk_widget_send_key()
    
    It's unused in GTK.

 docs/reference/gtk/gtk4-sections.txt |    1 -
 gtk/gtktestutils.c                   |   60 ----------------------------------
 gtk/gtktestutils.h                   |    4 --
 3 files changed, 0 insertions(+), 65 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 154658f..1074eff 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -6013,7 +6013,6 @@ gtk_page_setup_unix_dialog_get_type
 gtk_test_init
 gtk_test_list_all_types
 gtk_test_register_all_types
-gtk_test_widget_send_key
 gtk_test_widget_wait_for_draw
 </SECTION>
 
diff --git a/gtk/gtktestutils.c b/gtk/gtktestutils.c
index 45ff987..c85fa25 100644
--- a/gtk/gtktestutils.c
+++ b/gtk/gtktestutils.c
@@ -99,30 +99,6 @@ gtk_test_init (int    *argcp,
   gtk_init (argcp, argvp);
 }
 
-static GSList*
-test_find_widget_input_windows (GtkWidget *widget,
-                                gboolean   input_only)
-{
-  GdkWindow *window;
-  GList *node, *children;
-  GSList *matches = NULL;
-  gpointer udata;
-
-  window = gtk_widget_get_window (widget);
-
-  gdk_window_get_user_data (window, &udata);
-  if (udata == widget && (!input_only || (GDK_IS_WINDOW (window) && gdk_window_is_input_only (GDK_WINDOW 
(window)))))
-    matches = g_slist_prepend (matches, window);
-  children = gdk_window_get_children (gtk_widget_get_parent_window (widget));
-  for (node = children; node; node = node->next)
-    {
-      gdk_window_get_user_data (node->data, &udata);
-      if (udata == widget && (!input_only || (GDK_IS_WINDOW (node->data) && gdk_window_is_input_only 
(GDK_WINDOW (node->data)))))
-        matches = g_slist_prepend (matches, node->data);
-    }
-  return g_slist_reverse (matches);
-}
-
 static gboolean
 quit_main_loop_callback (GtkWidget     *widget,
                          GdkFrameClock *frame_clock,
@@ -164,42 +140,6 @@ gtk_test_widget_wait_for_draw (GtkWidget *widget)
   gtk_main ();
 }
 
-/**
- * gtk_test_widget_send_key:
- * @widget: Widget to generate a key press and release on.
- * @keyval: A Gdk keyboard value.
- * @modifiers: Keyboard modifiers the event is setup with.
- *
- * This function will generate keyboard press and release events in
- * the middle of the first GdkWindow found that belongs to @widget.
- * For windowless widgets like #GtkButton (which returns %FALSE from
- * gtk_widget_get_has_window()), this will often be an
- * input-only event window. For other widgets, this is usually widget->window.
- * Certain caveats should be considered when using this function, in
- * particular because the mouse pointer is warped to the key press
- * location, see gdk_test_simulate_key() for details.
- *
- * Returns: whether all actions neccessary for the key event simulation were carried out successfully.
- *
- * Since: 2.14
- **/
-gboolean
-gtk_test_widget_send_key (GtkWidget      *widget,
-                          guint           keyval,
-                          GdkModifierType modifiers)
-{
-  gboolean k1res, k2res;
-  GSList *iwindows = test_find_widget_input_windows (widget, FALSE);
-  if (!iwindows)
-    iwindows = test_find_widget_input_windows (widget, TRUE);
-  if (!iwindows)
-    return FALSE;
-  k1res = gdk_test_simulate_key (iwindows->data, -1, -1, keyval, modifiers, GDK_KEY_PRESS);
-  k2res = gdk_test_simulate_key (iwindows->data, -1, -1, keyval, modifiers, GDK_KEY_RELEASE);
-  g_slist_free (iwindows);
-  return k1res && k2res;
-}
-
 static GType *all_registered_types = NULL;
 static guint  n_all_registered_types = 0;
 
diff --git a/gtk/gtktestutils.h b/gtk/gtktestutils.h
index 5c87f31..a64e2db 100644
--- a/gtk/gtktestutils.h
+++ b/gtk/gtktestutils.h
@@ -39,10 +39,6 @@ GDK_AVAILABLE_IN_ALL
 const GType*    gtk_test_list_all_types         (guint          *n_types);
 GDK_AVAILABLE_IN_3_10
 void            gtk_test_widget_wait_for_draw   (GtkWidget      *widget);
-GDK_AVAILABLE_IN_ALL
-gboolean        gtk_test_widget_send_key        (GtkWidget      *widget,
-                                                 guint           keyval,
-                                                 GdkModifierType modifiers);
 
 G_END_DECLS
 


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