Fixed too small completion box if completion list is small (#39).
authorDaniel Carl <danielcarl@gmx.de>
Sun, 30 Jun 2013 19:40:49 +0000 (21:40 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Sun, 30 Jun 2013 19:40:49 +0000 (21:40 +0200)
If there where only few item in completion list, the completion list where
shrinked under the allow winheight/3 value (only gtk3). Now we set the min
content height of the scrollable window also if this should already fit.

src/completion.c
src/main.c

index 2e38480..5f94cc2 100644 (file)
@@ -197,9 +197,10 @@ static void init_completion(GtkTreeModel *model)
     gtk_widget_get_preferred_size(comp.tree, NULL, &size);
     gtk_window_get_size(GTK_WINDOW(vb.gui.window), NULL, &height);
     height /= 3;
-    if (size.height > height) {
-        gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(comp.win), height);
-    }
+    gtk_scrolled_window_set_min_content_height(
+        GTK_SCROLLED_WINDOW(comp.win),
+        size.height > height ? height : size.height
+    );
 #else
     gtk_widget_size_request(comp.tree, &size);
     gtk_window_get_size(GTK_WINDOW(vb.gui.window), NULL, &height);
index 3efc6a2..733cf7f 100644 (file)
@@ -658,6 +658,7 @@ static void init_core(void)
     gui->adjust_h = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(gui->scroll));
     gui->adjust_v = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(gui->scroll));
 
+    /* GTK_POLICY_NEVER with gtk3 disallows window resizing and scrolling */
 #ifndef HAS_GTK3
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(gui->scroll), GTK_POLICY_NEVER, GTK_POLICY_NEVER);
 #endif