diff options
author | Colomban Wendling <ban@herbesfolles.org> | 2014-09-11 14:37:20 +0200 |
---|---|---|
committer | Colomban Wendling <ban@herbesfolles.org> | 2014-09-11 14:37:20 +0200 |
commit | 45c8b9da866ba4dd0844c73a1e0a5ebcca4fe877 (patch) | |
tree | 001eb36821f1b8d6fbe680f43ffa1d9a6e8e9552 /gtk/PlatGTK.cxx | |
parent | 46db7544819f10adf2ef8ebadb8aa32c0159a18d (diff) | |
download | scintilla-mirror-45c8b9da866ba4dd0844c73a1e0a5ebcca4fe877.tar.gz |
GTK: Fix auto-completion popup width to better fit contents
Diffstat (limited to 'gtk/PlatGTK.cxx')
-rw-r--r-- | gtk/PlatGTK.cxx | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 992a2aef8..b686f3202 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -1692,8 +1692,29 @@ PRectangle ListBoxX::GetDesiredRect() { if (width < 12) width = 12; rc.right = width * (aveCharWidth + aveCharWidth / 3); - if (Length() > rows) - rc.right = rc.right + 16; + // Add horizontal padding and borders + int horizontal_separator=0; + gtk_widget_style_get(PWidget(list), + "horizontal-separator", &horizontal_separator, NULL); + rc.right += horizontal_separator; +#if GTK_CHECK_VERSION(3,0,0) + rc.right += (padding.left + padding.right + + 2 * (gtk_container_get_border_width(GTK_CONTAINER(PWidget(list))) + 1)); +#else + rc.right += 2 * (PWidget(list)->style->xthickness + + GTK_CONTAINER(PWidget(list))->border_width); +#endif + if (Length() > rows) { + // Add the width of the scrollbar + GtkWidget *vscrollbar = + gtk_scrolled_window_get_vscrollbar(GTK_SCROLLED_WINDOW(scroller)); +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_get_preferred_size(vscrollbar, NULL, &req); +#else + gtk_widget_size_request(vscrollbar, &req); +#endif + rc.right += req.width; + } } return rc; } |