[gtk+] widget: Don't call snapshot vfunc if width or height are 0



commit 8f7a8ada18f0e7dff2296cf3451ff9116bd2d1e3
Author: Timm Bäder <mail baedert org>
Date:   Fri Feb 2 14:50:17 2018 +0100

    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.

 gtk/gtkwidget.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index d67c7a9..9976706 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -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))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]