[gtk] paned: Implement increased handle area using pick()



commit 07393997665bfc677903a7fd405cda2ac9f5a49b
Author: Timm Bäder <mail baedert org>
Date:   Wed Feb 13 15:37:54 2019 +0100

    paned: Implement increased handle area using pick()
    
    Otherwise, we do report the widgets below the invisible handle area as
    hovered or active.

 gtk/gtkpaned.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
---
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index c4bb503e39..2cd216657e 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -326,6 +326,23 @@ gtk_paned_motion (GtkEventControllerMotion *motion,
     }
 }
 
+static GtkWidget *
+gtk_paned_pick (GtkWidget *widget,
+                double     x,
+                double     y)
+{
+  GtkPaned *paned = GTK_PANED (widget);
+  GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
+  graphene_rect_t handle_area;
+
+  get_handle_area (paned, &handle_area);
+
+  if (graphene_rect_contains_point (&handle_area, &(graphene_point_t){x, y}))
+    return priv->handle_widget;
+
+  return GTK_WIDGET_CLASS (gtk_paned_parent_class)->pick (widget, x, y);
+}
+
 static void
 gtk_paned_class_init (GtkPanedClass *class)
 {
@@ -348,6 +365,7 @@ gtk_paned_class_init (GtkPanedClass *class)
   widget_class->size_allocate = gtk_paned_size_allocate;
   widget_class->unrealize = gtk_paned_unrealize;
   widget_class->focus = gtk_paned_focus;
+  widget_class->pick = gtk_paned_pick;
 
   container_class->add = gtk_paned_add;
   container_class->remove = gtk_paned_remove;


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