[gtksourceview] CompletionContainer: chain-up in get_preferred_width/height()



commit d500d6e814c799bc1f574110a513bd8265162c1e
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu May 19 07:52:26 2016 +0200

    CompletionContainer: chain-up in get_preferred_width/height()
    
    To fix this critical message:
    Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: assertion
    'height >= 0' failed
    
    Thanks to slaf for the suggestion on IRC.

 gtksourceview/gtksourcecompletioncontainer.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletioncontainer.c b/gtksourceview/gtksourcecompletioncontainer.c
index db138ac..f36fcc0 100644
--- a/gtksourceview/gtksourcecompletioncontainer.c
+++ b/gtksourceview/gtksourcecompletioncontainer.c
@@ -2,7 +2,7 @@
 /* gtksourcecompletioncontainer.c
  * This file is part of GtkSourceView
  *
- * Copyright (C) 2013, 2014 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright (C) 2013, 2014, 2016 - Sébastien Wilmet <swilmet gnome org>
  *
  * GtkSourceView is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -78,6 +78,17 @@ _gtk_source_completion_container_get_preferred_width (GtkWidget *widget,
 
        width = MIN (nat_size.width, get_max_width (container));
 
+       if (GTK_WIDGET_CLASS (_gtk_source_completion_container_parent_class)->get_preferred_width != NULL)
+       {
+               gint min_width_parent = 0;
+
+               GTK_WIDGET_CLASS (_gtk_source_completion_container_parent_class)->get_preferred_width (widget,
+                                                                                                      
&min_width_parent,
+                                                                                                      NULL);
+
+               width = MAX (width, min_width_parent);
+       }
+
        if (min_width != NULL)
        {
                *min_width = width;
@@ -158,6 +169,17 @@ _gtk_source_completion_container_get_preferred_height (GtkWidget *widget,
                height = n_rows_allowed * row_height;
        }
 
+       if (GTK_WIDGET_CLASS (_gtk_source_completion_container_parent_class)->get_preferred_height != NULL)
+       {
+               gint min_height_parent = 0;
+
+               GTK_WIDGET_CLASS (_gtk_source_completion_container_parent_class)->get_preferred_height 
(widget,
+                                                                                                       
&min_height_parent,
+                                                                                                       NULL);
+
+               height = MAX (height, min_height_parent);
+       }
+
        if (min_height != NULL)
        {
                *min_height = height;


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