widget: Don't call snapshot vfunc if width or height are 0

The result won't be visible anyway. This also prevents problems with
widgets that create some resource the size of the widget, like
GtkGLArea. It also keeps us from snapshotting revealers with
size 0.
This commit is contained in:
Timm Bäder
2018-02-02 14:50:17 +01:00
parent f52100c46e
commit 8f7a8ada18

View File

@@ -14165,7 +14165,8 @@ gtk_widget_snapshot (GtkWidget *widget,
/* Offset to content allocation */
gtk_snapshot_offset (snapshot, margin.left + padding.left + border.left, margin.top + border.top + padding.top);
klass->snapshot (widget, snapshot);
if (gtk_widget_get_width (widget) > 0 || gtk_widget_get_height (widget) > 0)
klass->snapshot (widget, snapshot);
gtk_snapshot_offset (snapshot, - (margin.left + padding.left + border.left), -(margin.top + border.top + padding.top));
if (g_signal_has_handler_pending (widget, widget_signals[DRAW], 0, FALSE))