[gtk+] paned: Restrict picking to allocation



commit 49e624bbe9ee2c97cfea0a5a7670d6b13a5eae0c
Author: Timm Bäder <mail baedert org>
Date:   Wed Dec 6 08:23:03 2017 +0100

    paned: Restrict picking to allocation
    
    Same reason as GtkViewport does it: We might allocate child widgets
    outside of the paned's content allocation. For drawing, we add a clip
    node.
    
    This was causing the "Record" button in the inspector recorder to ignore
    pointer events since the treeview column header label in the GtkPaned
    was swallowing it.

 gtk/gtkpaned.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 329b9d5..04d8829 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -332,6 +332,25 @@ gtk_paned_motion_notify (GtkWidget      *widget,
   return GTK_WIDGET_CLASS (gtk_paned_parent_class)->motion_notify_event (widget, event);
 }
 
+static GtkWidget *
+gtk_paned_pick (GtkWidget *widget,
+                   double     x,
+                   double     y)
+{
+  if (x >= 0 && x <= gtk_widget_get_width (widget) &&
+      y >= 0 && y <= gtk_widget_get_height(widget))
+    {
+      return GTK_WIDGET_CLASS (gtk_paned_parent_class)->pick (widget, x, y);
+    }
+  else
+    {
+      if (gtk_widget_contains (widget, x, y))
+        return widget;
+      else
+        return NULL;
+    }
+}
+
 static void
 gtk_paned_class_init (GtkPanedClass *class)
 {
@@ -357,6 +376,7 @@ gtk_paned_class_init (GtkPanedClass *class)
   widget_class->focus = gtk_paned_focus;
   widget_class->motion_notify_event = gtk_paned_motion_notify;
   widget_class->direction_changed = gtk_paned_direction_changed;
+  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]