[gtksourceview/wip/fix-completion-sizing: 2/2] completion sizing: some tests



commit 815025e0e5b942af1f2c010bee7a50a0afaf9a18
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Jun 1 17:15:58 2014 +0200

    completion sizing: some tests
    
    The scrolled window height can not be smaller than 55 pixels, so when
    the tree view contains one or two rows, the scrolled window is too big.
    
    Another bug: when the scrolled window is resized at a row boundary, we
    can see a little the next row. Probably due to the vertical-separator
    height (one too much).

 gtksourceview/gtksourcecompletion.c |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 1f645b1..4ef9884 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -740,28 +740,38 @@ static void
 resize_scrolled_window (GtkSourceCompletion *completion)
 {
        GtkRequisition nat_size;
-       gint scrolled_window_width = 0;
-       gint scrolled_window_height = 0;
+       gint width = 0;
+       gint height = 0;
        gint tree_view_available_width = 0;
 
        gtk_widget_get_preferred_size (GTK_WIDGET (completion->priv->tree_view_proposals),
                                       NULL,
                                       &nat_size);
 
+       g_message ("tree view nat size: %d, %d", nat_size.width, nat_size.height);
+
        get_scrolled_window_width (completion,
                                   nat_size.width,
                                   nat_size.height,
-                                  &scrolled_window_width,
+                                  &width,
                                   &tree_view_available_width);
 
-       scrolled_window_height = get_scrolled_window_height (completion,
-                                                            nat_size.width,
-                                                            nat_size.height,
-                                                            tree_view_available_width);
+       height = get_scrolled_window_height (completion,
+                                            nat_size.width,
+                                            nat_size.height,
+                                            tree_view_available_width);
+
+       g_message ("set scrolled window size: %d, %d", width, height);
 
        gtk_widget_set_size_request (GTK_WIDGET (completion->priv->scrolled_window),
-                                    scrolled_window_width,
-                                    scrolled_window_height);
+                                    width,
+                                    height);
+
+       gtk_widget_get_preferred_height (GTK_WIDGET (completion->priv->scrolled_window),
+                                        &height,
+                                        NULL);
+
+       g_message ("scrolled window preferred height: %d", height);
 }
 
 static void


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