We cannot fast-track picking by using gtk_widget_contains(). Child
widgets may extend their parent using ie negative margins.
This is not just a theoretical concern, this is what's happening right
now with GtkScale's sliders relative to the trough.
The problem is that we now iterate through all widgets, even when they
aren't anywhere near the mouse pointer. So essentially every pick
operation is now guaranteed O(N_WIDGETS) which used to be the worst case
that pretty much never happened.
{
GtkWidget *child;
- if (!gtk_widget_contains (widget, x, y))
- return NULL;
-
for (child = _gtk_widget_get_last_child (widget);
child;
child = _gtk_widget_get_prev_sibling (child))
return picked;
}
+ if (!gtk_widget_contains (widget, x, y))
+ return NULL;
+
return widget;
}
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+ if (gtk_widget_get_pass_through (widget) ||
+ !gtk_widget_is_sensitive (widget) ||
+ !gtk_widget_is_drawable (widget))
+ return NULL;
+
return GTK_WIDGET_GET_CLASS (widget)->pick (widget, x, y);
}