[gtk+/wip/baedert/box: 185/234] gtkmain: Remove deprecated key snooper API



commit 60d88a5426ec3a49727c627e6353808e826f9c5e
Author: Timm Bäder <mail baedert org>
Date:   Tue Oct 11 14:37:22 2016 +0200

    gtkmain: Remove deprecated key snooper API

 docs/reference/gtk/gtk4-sections.txt |    5 --
 gtk/gtkmain.c                        |  108 ----------------------------------
 gtk/gtkmain.h                        |   21 -------
 3 files changed, 0 insertions(+), 134 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 95b4d87..1d984a3 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -5507,11 +5507,6 @@ gtk_device_grab_remove
 GTK_PRIORITY_RESIZE
 
 <SUBSECTION>
-gtk_key_snooper_install
-GtkKeySnoopFunc
-gtk_key_snooper_remove
-
-<SUBSECTION>
 gtk_get_current_event
 gtk_get_current_event_time
 gtk_get_current_event_state
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 9e2a6df..7885ccf 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -132,20 +132,6 @@
 
 #include "a11y/gtkaccessibility.h"
 
-/* Private type definitions
- */
-typedef struct _GtkKeySnooperData        GtkKeySnooperData;
-
-struct _GtkKeySnooperData
-{
-  GtkKeySnoopFunc func;
-  gpointer func_data;
-  guint id;
-};
-
-static gint  gtk_invoke_key_snoopers     (GtkWidget          *grab_widget,
-                                          GdkEvent           *event);
-
 static GtkWindowGroup *gtk_main_get_window_group (GtkWidget   *widget);
 
 static guint gtk_main_loop_level = 0;
@@ -155,8 +141,6 @@ static GList *current_events = NULL;
 
 static GSList *main_loops = NULL;      /* stack of currently executing main loops */
 
-static GSList *key_snoopers = NULL;
-
 typedef struct {
   GdkDisplay *display;
   guint flags;
@@ -1645,9 +1629,6 @@ check_event_in_child_popover (GtkWidget *event_widget,
  *      event delivered to it before without the paired leave event.
  *    - Drag events are not redirected because it is unclear what the semantics
  *      of that would be.
- *    Another point of interest might be that all key events are first passed
- *    through the key snooper functions if there are any. Read the description
- *    of gtk_key_snooper_install() if you need this feature.
  * 
  * 5. After finishing the delivery the event is popped from the event stack.
  */
@@ -1827,9 +1808,6 @@ gtk_main_do_event (GdkEvent *event)
 
     case GDK_KEY_PRESS:
     case GDK_KEY_RELEASE:
-      if (gtk_invoke_key_snoopers (grab_widget, event))
-        break;
-
       /* make focus visible in a window that receives a key event */
       {
         GtkWidget *window;
@@ -2329,92 +2307,6 @@ gtk_device_grab_remove (GtkWidget *widget,
 }
 
 /**
- * gtk_key_snooper_install: (skip)
- * @snooper: a #GtkKeySnoopFunc
- * @func_data: (closure): data to pass to @snooper
- *
- * Installs a key snooper function, which will get called on all
- * key events before delivering them normally.
- *
- * Returns: a unique id for this key snooper for use with
- *    gtk_key_snooper_remove().
- *
- * Deprecated: 3.4: Key snooping should not be done. Events should
- *     be handled by widgets.
- */
-guint
-gtk_key_snooper_install (GtkKeySnoopFunc snooper,
-                         gpointer        func_data)
-{
-  GtkKeySnooperData *data;
-  static guint snooper_id = 1;
-
-  g_return_val_if_fail (snooper != NULL, 0);
-
-  data = g_new (GtkKeySnooperData, 1);
-  data->func = snooper;
-  data->func_data = func_data;
-  data->id = snooper_id++;
-  key_snoopers = g_slist_prepend (key_snoopers, data);
-
-  return data->id;
-}
-
-/**
- * gtk_key_snooper_remove:
- * @snooper_handler_id: Identifies the key snooper to remove
- *
- * Removes the key snooper function with the given id.
- *
- * Deprecated: 3.4: Key snooping should not be done. Events should
- *     be handled by widgets.
- */
-void
-gtk_key_snooper_remove (guint snooper_id)
-{
-  GtkKeySnooperData *data = NULL;
-  GSList *slist;
-
-  slist = key_snoopers;
-  while (slist)
-    {
-      data = slist->data;
-      if (data->id == snooper_id)
-        break;
-
-      slist = slist->next;
-      data = NULL;
-    }
-  if (data)
-    {
-      key_snoopers = g_slist_remove (key_snoopers, data);
-      g_free (data);
-    }
-}
-
-static gint
-gtk_invoke_key_snoopers (GtkWidget *grab_widget,
-                         GdkEvent  *event)
-{
-  GSList *slist;
-  gint return_val = FALSE;
-
-  return_val = _gtk_accessibility_key_snooper (grab_widget, (GdkEventKey *) event);
-
-  slist = key_snoopers;
-  while (slist && !return_val)
-    {
-      GtkKeySnooperData *data;
-
-      data = slist->data;
-      slist = slist->next;
-      return_val = (*data->func) (grab_widget, (GdkEventKey*) event, data->func_data);
-    }
-
-  return return_val;
-}
-
-/**
  * gtk_get_current_event:
  *
  * Obtains a copy of the event currently being processed by GTK+.
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
index 8c3b17f..47de9b6 100644
--- a/gtk/gtkmain.h
+++ b/gtk/gtkmain.h
@@ -50,21 +50,6 @@ G_BEGIN_DECLS
  */
 #define GTK_PRIORITY_RESIZE (G_PRIORITY_HIGH_IDLE + 10)
 
-/**
- * GtkKeySnoopFunc:
- * @grab_widget: the widget to which the event will be delivered
- * @event: the key event
- * @func_data: (closure): data supplied to gtk_key_snooper_install()
- *
- * Key snooper functions are called before normal event delivery.
- * They can be used to implement custom key event handling.
- *
- * Returns: %TRUE to stop further processing of @event, %FALSE to continue.
- */
-typedef gint (*GtkKeySnoopFunc) (GtkWidget   *grab_widget,
-                                 GdkEventKey *event,
-                                 gpointer     func_data);
-
 /* GTK+ version
  */
 GDK_AVAILABLE_IN_ALL
@@ -181,12 +166,6 @@ GDK_AVAILABLE_IN_ALL
 void       gtk_device_grab_remove  (GtkWidget          *widget,
                                     GdkDevice          *device);
 
-GDK_DEPRECATED_IN_3_4
-guint      gtk_key_snooper_install (GtkKeySnoopFunc snooper,
-                                    gpointer        func_data);
-GDK_DEPRECATED_IN_3_4
-void       gtk_key_snooper_remove  (guint           snooper_handler_id);
-
 GDK_AVAILABLE_IN_ALL
 GdkEvent * gtk_get_current_event        (void);
 GDK_AVAILABLE_IN_ALL


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