[gtk+] gtktexttag: Remove GtkTextTag::event and gtk_text_tag_event()



commit d65d5d0a84bcbb8fd3fa326336f07d1d7d2afa94
Author: Benjamin Otte <otte redhat com>
Date:   Sat Nov 11 04:01:55 2017 +0100

    gtktexttag: Remove GtkTextTag::event and gtk_text_tag_event()
    
    GtkSourceView is not using it, so it's unneeded. And it's certainly
    diving deep into event internals of GtkTextView which hinders a proper
    gesturization.

 docs/reference/gtk/gtk4-sections.txt |    1 -
 gtk/gtktexttag.c                     |   70 -------------------
 gtk/gtktexttag.h                     |   10 ---
 gtk/gtktextview.c                    |  122 ----------------------------------
 4 files changed, 0 insertions(+), 203 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index a891386..3371c6d 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -3044,7 +3044,6 @@ GtkTextTag
 gtk_text_tag_new
 gtk_text_tag_get_priority
 gtk_text_tag_set_priority
-gtk_text_tag_event
 gtk_text_tag_changed
 <SUBSECTION Standard>
 GTK_TEXT_TAG
diff --git a/gtk/gtktexttag.c b/gtk/gtktexttag.c
index e149e81..d6c1a55 100644
--- a/gtk/gtktexttag.c
+++ b/gtk/gtktexttag.c
@@ -83,11 +83,6 @@
 #include "gtktypebuiltins.h"
 
 enum {
-  EVENT,
-  LAST_SIGNAL
-};
-
-enum {
   PROP_0,
   /* Construct args */
   PROP_NAME,
@@ -180,8 +175,6 @@ static void gtk_text_tag_get_property (GObject         *object,
                                        GValue          *value,
                                        GParamSpec      *pspec);
 
-static guint signals[LAST_SIGNAL] = { 0 };
-
 G_DEFINE_TYPE_WITH_PRIVATE (GtkTextTag, gtk_text_tag, G_TYPE_OBJECT)
 
 static void
@@ -803,35 +796,6 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
   ADD_SET_PROP ("font-features-set", PROP_FONT_FEATURES_SET,
                 P_("Font features set"),
                 P_("Whether this tag affects font features"));
-
-  /**
-   * GtkTextTag::event:
-   * @tag: the #GtkTextTag on which the signal is emitted
-   * @object: the object the event was fired from (typically a #GtkTextView)
-   * @event: the event which triggered the signal
-   * @iter: a #GtkTextIter pointing at the location the event occurred
-   *
-   * The ::event signal is emitted when an event occurs on a region of the
-   * buffer marked with this tag.
-   *
-   * Returns: %TRUE to stop other handlers from being invoked for the
-   * event. %FALSE to propagate the event further.
-   */
-  signals[EVENT] =
-    g_signal_new (I_("event"),
-                  G_OBJECT_CLASS_TYPE (object_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (GtkTextTagClass, event),
-                  _gtk_boolean_handled_accumulator, NULL,
-                  _gtk_marshal_BOOLEAN__OBJECT_BOXED_BOXED,
-                  G_TYPE_BOOLEAN,
-                  3,
-                  G_TYPE_OBJECT,
-                  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE,
-                  GTK_TYPE_TEXT_ITER);
-  g_signal_set_va_marshaller (signals[EVENT],
-                              G_OBJECT_CLASS_TYPE (object_class),
-                              _gtk_marshal_BOOLEAN__OBJECT_BOXED_BOXEDv);
 }
 
 static void
@@ -2066,40 +2030,6 @@ gtk_text_tag_set_priority (GtkTextTag *tag,
 }
 
 /**
- * gtk_text_tag_event:
- * @tag: a #GtkTextTag
- * @event_object: object that received the event, such as a widget
- * @event: the event
- * @iter: location where the event was received
- * 
- * Emits the “event” signal on the #GtkTextTag.
- * 
- * Returns: result of signal emission (whether the event was handled)
- **/
-gboolean
-gtk_text_tag_event (GtkTextTag        *tag,
-                    GObject           *event_object,
-                    GdkEvent          *event,
-                    const GtkTextIter *iter)
-{
-  gboolean retval = FALSE;
-
-  g_return_val_if_fail (GTK_IS_TEXT_TAG (tag), FALSE);
-  g_return_val_if_fail (G_IS_OBJECT (event_object), FALSE);
-  g_return_val_if_fail (event != NULL, FALSE);
-
-  g_signal_emit (tag,
-                 signals[EVENT],
-                 0,
-                 event_object,
-                 event,
-                 iter,
-                 &retval);
-
-  return retval;
-}
-
-/**
  * gtk_text_tag_changed:
  * @tag: a #GtkTextTag.
  * @size_changed: whether the change affects the #GtkTextView layout.
diff --git a/gtk/gtktexttag.h b/gtk/gtktexttag.h
index 3e4ed33..b6daa7c 100644
--- a/gtk/gtktexttag.h
+++ b/gtk/gtktexttag.h
@@ -86,11 +86,6 @@ struct _GtkTextTagClass
 {
   GObjectClass parent_class;
 
-  gboolean (* event) (GtkTextTag        *tag,
-                      GObject           *event_object, /* widget, canvas item, whatever */
-                      GdkEvent          *event,        /* the event itself */
-                      const GtkTextIter *iter);        /* location of event in buffer */
-
   /* Padding for future expansion */
   void (*_gtk_reserved1) (void);
   void (*_gtk_reserved2) (void);
@@ -107,11 +102,6 @@ gint         gtk_text_tag_get_priority (GtkTextTag        *tag);
 GDK_AVAILABLE_IN_ALL
 void         gtk_text_tag_set_priority (GtkTextTag        *tag,
                                         gint               priority);
-GDK_AVAILABLE_IN_ALL
-gboolean     gtk_text_tag_event        (GtkTextTag        *tag,
-                                        GObject           *event_object,
-                                        GdkEvent          *event,
-                                        const GtkTextIter *iter);
 GDK_AVAILABLE_IN_3_20
 void         gtk_text_tag_changed      (GtkTextTag        *tag,
                                         gboolean           size_changed);
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 36734e1..940e05c 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -409,8 +409,6 @@ static void gtk_text_view_drag_gesture_end           (GtkGestureDrag *gesture,
                                                       gdouble         offset_y,
                                                       GtkTextView    *text_view);
 
-static gint gtk_text_view_event                (GtkWidget        *widget,
-                                                GdkEvent         *event);
 static gint gtk_text_view_key_press_event      (GtkWidget        *widget,
                                                 GdkEventKey      *event);
 static gint gtk_text_view_key_release_event    (GtkWidget        *widget,
@@ -741,7 +739,6 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
   widget_class->state_flags_changed = gtk_text_view_state_flags_changed;
   widget_class->measure = gtk_text_view_measure;
   widget_class->size_allocate = gtk_text_view_size_allocate;
-  widget_class->event = gtk_text_view_event;
   widget_class->key_press_event = gtk_text_view_key_press_event;
   widget_class->key_release_event = gtk_text_view_key_release_event;
   widget_class->focus_in_event = gtk_text_view_focus_in_event;
@@ -4886,77 +4883,6 @@ gtk_text_view_unobscure_mouse_cursor (GtkTextView *text_view)
  * Events
  */
 
-static gboolean
-get_event_coordinates (GdkEvent *event, gint *x, gint *y)
-{
-  gdouble event_x, event_y;
-
-  if (event)
-    switch ((guint) gdk_event_get_event_type (event))
-      {
-      case GDK_MOTION_NOTIFY:
-      case GDK_BUTTON_PRESS:
-      case GDK_BUTTON_RELEASE:
-        gdk_event_get_coords (event, &event_x, &event_y);
-        *x = event_x;
-        *y = event_y;
-        return TRUE;
-        break;
-
-      case GDK_KEY_PRESS:
-      case GDK_KEY_RELEASE:
-      case GDK_ENTER_NOTIFY:
-      case GDK_LEAVE_NOTIFY:
-      case GDK_PROPERTY_NOTIFY:
-      case GDK_SELECTION_CLEAR:
-      case GDK_SELECTION_REQUEST:
-      case GDK_SELECTION_NOTIFY:
-      case GDK_PROXIMITY_IN:
-      case GDK_PROXIMITY_OUT:
-      case GDK_DRAG_ENTER:
-      case GDK_DRAG_LEAVE:
-      case GDK_DRAG_MOTION:
-      case GDK_DRAG_STATUS:
-      case GDK_DROP_START:
-      case GDK_DROP_FINISHED:
-      default:
-        return FALSE;
-        break;
-      }
-
-  return FALSE;
-}
-
-static gint
-emit_event_on_tags (GtkWidget   *widget,
-                    GdkEvent    *event,
-                    GtkTextIter *iter)
-{
-  GSList *tags;
-  GSList *tmp;
-  gboolean retval = FALSE;
-
-  tags = gtk_text_iter_get_tags (iter);
-
-  tmp = tags;
-  while (tmp != NULL)
-    {
-      GtkTextTag *tag = tmp->data;
-
-      if (gtk_text_tag_event (tag, G_OBJECT (widget), event, iter))
-        {
-          retval = TRUE;
-          break;
-        }
-
-      tmp = tmp->next;
-    }
-
-  g_slist_free (tags);
-
-  return retval;
-}
-
 static void
 _text_window_to_widget_coords (GtkTextView *text_view,
                                gint        *x,
@@ -5265,54 +5191,6 @@ gtk_text_view_update_handles (GtkTextView       *text_view,
 }
 
 static gint
-gtk_text_view_event (GtkWidget *widget, GdkEvent *event)
-{
-  GtkTextView *text_view;
-  GtkTextViewPrivate *priv;
-  gint x = 0, y = 0;
-  GdkEventType event_type;
-
-  text_view = GTK_TEXT_VIEW (widget);
-  priv = text_view->priv;
-
-  if (priv->layout == NULL ||
-      get_buffer (text_view) == NULL)
-    return FALSE;
-
-  event_type = gdk_event_get_event_type (event);
-
-  if (get_event_coordinates (event, &x, &y))
-    {
-      GtkTextIter iter;
-
-      x += priv->xoffset;
-      y += priv->yoffset;
-
-      /* FIXME this is slow and we do it twice per event.
-       * My favorite solution is to have GtkTextLayout cache
-       * the last couple lookups.
-       */
-      gtk_text_layout_get_iter_at_pixel (priv->layout,
-                                         &iter,
-                                         x, y);
-
-      return emit_event_on_tags (widget, event, &iter);
-    }
-  else if (event_type == GDK_KEY_PRESS ||
-           event_type == GDK_KEY_RELEASE)
-    {
-      GtkTextIter iter;
-
-      gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter,
-                                        gtk_text_buffer_get_insert (get_buffer (text_view)));
-
-      return emit_event_on_tags (widget, event, &iter);
-    }
-  else
-    return FALSE;
-}
-
-static gint
 gtk_text_view_key_press_event (GtkWidget *widget, GdkEventKey *event)
 {
   GtkTextView *text_view;


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