From: Daniel Carl Date: Sun, 30 Jun 2013 19:40:49 +0000 (+0200) Subject: Fixed too small completion box if completion list is small (#39). X-Git-Url: https://git.owens.tech/git.owens.tech/git.owens.tech/git?a=commitdiff_plain;h=dd97c634228671cafddb38d61ccaf00b7275e6bb;p=vimb.git Fixed too small completion box if completion list is small (#39). 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. --- diff --git a/src/completion.c b/src/completion.c index 2e38480..5f94cc2 100644 --- a/src/completion.c +++ b/src/completion.c @@ -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); diff --git a/src/main.c b/src/main.c index 3efc6a2..733cf7f 100644 --- a/src/main.c +++ b/src/main.c @@ -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