GNOME Bugzilla – Bug 81156
Don't invalidate invisible widgets
Last modified: 2011-02-04 16:11:52 UTC
A small patch that makes gtk_widget_queue_clear_area() return if the widget is not visible. (Range widgets invalidates themselves on adjustment_changed even when they are hidden).
Created attachment 8288 [details] [review] patch
I think if we are going to do this, we probably should do the full check for the widget and all its parents being GTK_WIDGET_MAPPED - otherwise there are still cases where we'll invalidate unnecessary when a NO_WINDOW widget is a child of a not-visible NO_WINDOW widget. (If we did that, could we get rid of the gdk_window_is_viewable() check? I can't think of any cases in GTK+ where a widget gdk_window_hide()'s the parent window of a child widget without gtk_widget_unmapping the window, so I think we can safely remove it and avoid an extra walk up the widget heirarchy, though it is certainly possible for it to catch something that you woudln't catch by checking GTK_WIDGET_MAPPED())
Right, it should definitely be safe to omit the call since the worst thing that can happen is an unnecessary invalidation. If we find out that there widgets that does this, then we can add the check again. Here is a new patch that checks that all ancestors are mapped and removes the viewable check.
Created attachment 11521 [details] [review] The new patch
Looks fine to commit to me (HEAD branch only).
Sun Oct 13 17:41:53 2002 Soeren Sandmann <sandmann@daimi.au.dk> * gtk/gtkwidget.c (gtk_widget_queue_clear_area): Don't invalidate a widget if it or one of its ancestors isn't mapped.