tests: Remove gtk_widget_send_key()

It's unused in GTK.
This commit is contained in:
Benjamin Otte 2017-01-08 01:47:51 +01:00
parent daf0270f1a
commit 2a9ae1e8df
3 changed files with 0 additions and 65 deletions

View File

@ -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>

View File

@ -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;

View File

@ -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