From b706fd7443e5c2364d48f822b4e956bc589b1116 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 24 Sep 2014 18:25:51 +0200 Subject: GTK: Fix auto-completion popup row height computation on GTK 3.14 GTK 3.14 changed how the cell padding is calculated, and I can't seem to understand the new logic yet. So, use the correct API for computing the row size, which unfortunately doesn't work for us on GTK2, but otherwise is a better way to go anyway. Tested with GTK 3.2, 3.8, 3.10, 3.12 and 3.14. --- gtk/PlatGTK.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 28ad37140..c1d7ac7ae 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -1658,6 +1658,14 @@ int ListBoxX::GetVisibleRows() const { int ListBoxX::GetRowHeight() { +#if GTK_CHECK_VERSION(3,0,0) + // This version sometimes reports erroneous results on GTK2, but the GTK2 + // version is inaccurate for GTK 3.14. + GdkRectangle rect; + GtkTreePath *path = gtk_tree_path_new_first(); + gtk_tree_view_get_background_area(GTK_TREE_VIEW(list), path, NULL, &rect); + return rect.height; +#else int row_height=0; int vertical_separator=0; int expander_size=0; @@ -1669,6 +1677,7 @@ int ListBoxX::GetRowHeight() row_height += vertical_separator; row_height = Platform::Maximum(row_height, expander_size); return row_height; +#endif } PRectangle ListBoxX::GetDesiredRect() { -- cgit v1.2.3