[gtk/drop-click-gesture-area] gestureclick: Drop the area



commit 8ad49b33ed1fbef7de4237d12bc8fb687e090f15
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed May 6 14:19:50 2020 -0400

    gestureclick: Drop the area
    
    This is a rarely used api, and our general trend has been
    to use widgets whenever we need an area singled out.

 docs/reference/gtk/gtk4-sections.txt |  2 -
 gtk/gtkgestureclick.c                | 82 +-----------------------------------
 gtk/gtkgestureclick.h                |  7 ---
 3 files changed, 2 insertions(+), 89 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 92946bc977..6a3f16b13a 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -6223,8 +6223,6 @@ gtk_gesture_long_press_get_type
 <TITLE>GtkGestureClick</TITLE>
 GtkGestureClick
 gtk_gesture_click_new
-gtk_gesture_click_set_area
-gtk_gesture_click_get_area
 
 <SUBSECTION Standard>
 GTK_TYPE_GESTURE_CLICK
diff --git a/gtk/gtkgestureclick.c b/gtk/gtkgestureclick.c
index 9d8e95404f..48968e4ab8 100644
--- a/gtk/gtkgestureclick.c
+++ b/gtk/gtkgestureclick.c
@@ -46,7 +46,6 @@ typedef struct _GtkGestureClickPrivate GtkGestureClickPrivate;
 
 struct _GtkGestureClickPrivate
 {
-  GdkRectangle rect;
   GdkDevice *current_device;
   gdouble initial_press_x;
   gdouble initial_press_y;
@@ -54,7 +53,6 @@ struct _GtkGestureClickPrivate
   guint n_presses;
   guint n_release;
   guint current_button;
-  guint rect_is_set : 1;
 };
 
 enum {
@@ -179,12 +177,7 @@ _gtk_gesture_click_check_within_threshold (GtkGestureClick *gesture,
 
   if (ABS (priv->initial_press_x - x) < double_click_distance &&
       ABS (priv->initial_press_y - y) < double_click_distance)
-    {
-      if (!priv->rect_is_set ||
-          (x >= priv->rect.x && x < priv->rect.x + priv->rect.width &&
-           y >= priv->rect.y && y < priv->rect.y + priv->rect.height))
-        return TRUE;
-    }
+    return TRUE;
 
   return FALSE;
 }
@@ -459,76 +452,5 @@ gtk_gesture_click_init (GtkGestureClick *gesture)
 GtkGesture *
 gtk_gesture_click_new (void)
 {
-  return g_object_new (GTK_TYPE_GESTURE_CLICK,
-                       NULL);
-}
-
-/**
- * gtk_gesture_click_set_area:
- * @gesture: a #GtkGestureClick
- * @rect: (allow-none): rectangle to receive coordinates on
- *
- * If @rect is non-%NULL, the press area will be checked to be
- * confined within the rectangle, otherwise the button count
- * will be reset so the press is seen as being the first one.
- * If @rect is %NULL, the area will be reset to an unrestricted
- * state.
- *
- * Note: The rectangle is only used to determine whether any
- * non-first click falls within the expected area. This is not
- * akin to an input shape.
- **/
-void
-gtk_gesture_click_set_area (GtkGestureClick    *gesture,
-                            const GdkRectangle *rect)
-{
-  GtkGestureClickPrivate *priv;
-
-  g_return_if_fail (GTK_IS_GESTURE_CLICK (gesture));
-
-  priv = gtk_gesture_click_get_instance_private (gesture);
-
-  if (!rect)
-    priv->rect_is_set = FALSE;
-  else
-    {
-      priv->rect_is_set = TRUE;
-      priv->rect = *rect;
-    }
-}
-
-/**
- * gtk_gesture_click_get_area:
- * @gesture: a #GtkGestureClick
- * @rect: (out): return location for the press area
- *
- * If an area was set through gtk_gesture_click_set_area(),
- * this function will return %TRUE and fill in @rect with the
- * press area. See gtk_gesture_click_set_area() for more
- * details on what the press area represents.
- *
- * Returns: %TRUE if @rect was filled with the press area
- **/
-gboolean
-gtk_gesture_click_get_area (GtkGestureClick *gesture,
-                            GdkRectangle    *rect)
-{
-  GtkGestureClickPrivate *priv;
-
-  g_return_val_if_fail (GTK_IS_GESTURE_CLICK (gesture), FALSE);
-
-  priv = gtk_gesture_click_get_instance_private (gesture);
-
-  if (rect)
-    {
-      if (priv->rect_is_set)
-        *rect = priv->rect;
-      else
-        {
-          rect->x = rect->y = G_MININT;
-          rect->width = rect->height = G_MAXINT;
-        }
-    }
-
-  return priv->rect_is_set;
+  return g_object_new (GTK_TYPE_GESTURE_CLICK, NULL);
 }
diff --git a/gtk/gtkgestureclick.h b/gtk/gtkgestureclick.h
index ea86fdb6d5..7d42b44863 100644
--- a/gtk/gtkgestureclick.h
+++ b/gtk/gtkgestureclick.h
@@ -44,13 +44,6 @@ GType        gtk_gesture_click_get_type (void) G_GNUC_CONST;
 GDK_AVAILABLE_IN_ALL
 GtkGesture * gtk_gesture_click_new      (void);
 
-GDK_AVAILABLE_IN_ALL
-void         gtk_gesture_click_set_area (GtkGestureClick    *gesture,
-                                         const GdkRectangle *rect);
-GDK_AVAILABLE_IN_ALL
-gboolean     gtk_gesture_click_get_area (GtkGestureClick    *gesture,
-                                         GdkRectangle       *rect);
-
 G_END_DECLS
 
 #endif /* __GTK_GESTURE_CLICK_H__ */


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