aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColomban Wendling <ban@herbesfolles.org>2016-04-27 16:01:17 +0200
committerColomban Wendling <ban@herbesfolles.org>2016-04-27 16:01:17 +0200
commit24c4ae2522e856a27192287e6f4891c1f89e7fca (patch)
tree8ede12f59e1c91d35bfd27152aec1f81279d4d23
parentf4491cbfeda612215022ac0233fef99e05882bc9 (diff)
downloadscintilla-mirror-24c4ae2522e856a27192287e6f4891c1f89e7fca.tar.gz
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.
-rw-r--r--gtk/ScintillaGTK.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 85336ecdd..b737a9468 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -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);
}