From 49e624bbe9ee2c97cfea0a5a7670d6b13a5eae0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 6 Dec 2017 08:23:03 +0100 Subject: [PATCH] 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 file changed, 20 insertions(+) diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index 329b9d5692..04d8829b7f 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;