diff options
-rw-r--r-- | src/gtkext/diagram.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gtkext/diagram.c b/src/gtkext/diagram.c index 760e3ae..395d019 100644 --- a/src/gtkext/diagram.c +++ b/src/gtkext/diagram.c @@ -642,6 +642,7 @@ static GtkSizeRequestMode gtk_diagram_get_request_mode(GtkWidget *widget) static void gtk_diagram_get_preferred_width_for_height(GtkWidget *widget, gint height, gint *minimum, gint *natural) { + GdkWindow *window; /* FenĂȘtre du composant */ GtkDiagram *diagram; /* Autre version du composant */ gint text_width; /* Plus grande longueur */ cairo_surface_t *surface; /* Espace graphique de support */ @@ -649,6 +650,14 @@ static void gtk_diagram_get_preferred_width_for_height(GtkWidget *widget, gint h size_t i; /* Boucle de parcours */ cairo_text_extents_t extents; /* Taille de la police */ + window = gtk_widget_get_window(widget); + + if (window == NULL) + { + *minimum = 1; + goto conclusion; + } + diagram = GTK_DIAGRAM(widget); text_width = 0; @@ -703,6 +712,8 @@ static void gtk_diagram_get_preferred_width_for_height(GtkWidget *widget, gint h cairo_destroy(cr); cairo_surface_destroy(surface); + conclusion: + /* RĂ©percution */ *natural = *minimum; @@ -738,6 +749,8 @@ void gtk_diagram_clear_stats(GtkDiagram *diagram) diagram->stats = NULL; diagram->count = 0; + gtk_widget_queue_resize(GTK_WIDGET(diagram)); + } @@ -780,4 +793,6 @@ void gtk_diagram_add_stats(GtkDiagram *diagram, const diagram_stat_t *stats, siz diagram->count += count; + gtk_widget_queue_resize(GTK_WIDGET(diagram)); + } |