[geany/geany] d1e519: GTK: Fix auto-completion popup width to better fit contents

Colomban Wendling git-noreply at xxxxx
Mon Sep 15 13:58:42 UTC 2014


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 15 Sep 2014 13:58:42 UTC
Commit:      d1e519c11dec18e6738b80b3c76f16935f82f3ad
             https://github.com/geany/geany/commit/d1e519c11dec18e6738b80b3c76f16935f82f3ad

Log Message:
-----------
GTK: Fix auto-completion popup width to better fit contents


Modified Paths:
--------------
    scintilla/gtk/PlatGTK.cxx

Modified: scintilla/gtk/PlatGTK.cxx
25 lines changed, 23 insertions(+), 2 deletions(-)
===================================================================
@@ -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;
 }



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list