From 017f550a91bbc87f265b80fcf8f2538656d8328d Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Fri, 27 Dec 2013 14:40:32 +0100 Subject: [PATCH] Fixed wrong completion window size with gtk3. --- config.mk | 1 + src/completion.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/config.mk b/config.mk index 03f0c7c..c243a99 100644 --- 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) diff --git a/src/completion.c b/src/completion.c index f1b6dbd..1c71d9b 100644 --- a/src/completion.c +++ b/src/completion.c @@ -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); -- 2.20.1