Fixed wrong completion window size with gtk3.
authorDaniel Carl <danielcarl@gmx.de>
Fri, 27 Dec 2013 13:40:32 +0000 (14:40 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Fri, 27 Dec 2013 14:04:01 +0000 (15:04 +0100)
config.mk
src/completion.c

index 03f0c7c..c243a99 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -19,6 +19,7 @@ LIBS += $(GTK3LIBS)
 USEGTK3 = 1
 else
 LIBS += $(GTK2LIBS)
+$(warning Cannot find gtk3-libs, falling back to gtk2)
 endif
 else
 LIBS += $(GTK2LIBS)
index f1b6dbd..1c71d9b 100644 (file)
@@ -123,6 +123,13 @@ gboolean completion_create(GtkTreeModel *model, CompletionSelectFunc selfunc,
     gtk_tree_view_column_add_attribute(column, renderer, "text", COMPLETION_STORE_SECOND);
 #endif
 
+    /* this prevents the first item to be placed out of view if the completion
+     * is shown */
+    gtk_widget_show_all(comp.win);
+    while (gtk_events_pending()) {
+        gtk_main_iteration();
+    }
+
     /* use max 1/3 of window height for the completion */
 #ifdef HAS_GTK3
     gtk_widget_get_preferred_size(comp.tree, NULL, &size);
@@ -141,13 +148,6 @@ gboolean completion_create(GtkTreeModel *model, CompletionSelectFunc selfunc,
 
     vb.mode->flags |= FLAG_COMPLETION;
 
-    /* this prevents the first item to be placed out of view if the completion
-     * is shown */
-    gtk_widget_show_all(comp.win);
-    while (gtk_events_pending()) {
-        gtk_main_iteration();
-    }
-
     /* set to -1 to have the cursor on first or last item set in move_cursor */
     comp.active = -1;
     completion_next(back);