[geany/geany] 28a99f: GTK: Properly ask wText what size it wants to please GTK 3.20

Colomban Wendling git-noreply at xxxxx
Mon May 2 13:19:26 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 02 May 2016 13:19:26 UTC
Commit:      28a99f8188724a999f74751501c1e223c2d61a7f
             https://github.com/geany/geany/commit/28a99f8188724a999f74751501c1e223c2d61a7f

Log Message:
-----------
GTK: Properly ask wText what size it wants to please GTK 3.20

It's not really of any use as we do know any size would do as wText is
ours anyway, but GTK 3.20 doesn't like allocating without querying the
preferred size beforehand, so do it.

As wText has a size_request() of 100x100, this might change how we
allocate in case we used to underallocate it, but AFAIK we don't, and
it is the real minimum size expected.

X-Scintilla-Bug-URL: https://sourceforge.net/p/scintilla/bugs/1825/
X-Scintilla-Commit-ID: d06e3db3e26842cd136328df17eb6f864b3adc02


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

Modified: scintilla/gtk/ScintillaGTK.cxx
13 lines changed, 11 insertions(+), 2 deletions(-)
===================================================================
@@ -1769,8 +1769,17 @@ void ScintillaGTK::Resize(int width, int height) {
 
 	alloc.x = 0;
 	alloc.y = 0;
-	alloc.width = Platform::Maximum(1, width - verticalScrollBarWidth);
-	alloc.height = Platform::Maximum(1, height - horizontalScrollBarHeight);
+	alloc.width = 1;
+	alloc.height = 1;
+#if GTK_CHECK_VERSION(3, 0, 0)
+	// please GTK 3.20 and ask wText what size it wants, although we know it doesn't really need
+	// anything special as it's ours.
+	gtk_widget_get_preferred_size(PWidget(wText), &requisition, NULL);
+	alloc.width = requisition.width;
+	alloc.height = requisition.height;
+#endif
+	alloc.width = Platform::Maximum(alloc.width, width - verticalScrollBarWidth);
+	alloc.height = Platform::Maximum(alloc.height, height - horizontalScrollBarHeight);
 	gtk_widget_size_allocate(GTK_WIDGET(PWidget(wText)), &alloc);
 }
 



--------------
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