aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Sasongko <sasongko@gmail.com>2016-05-22 07:55:12 +1000
committerJohannes Sasongko <sasongko@gmail.com>2016-05-22 07:55:12 +1000
commit7a1afd092ba232b96278353bef709035871e4323 (patch)
tree7dd9be1166740b0d8113d10015bd299abe1f47e1
parentc4f9a3340cf911994b2af5e89cb5abf02d8796a3 (diff)
downloadscintilla-mirror-7a1afd092ba232b96278353bef709035871e4323.tar.gz
Bug [#1831]. Fix GTK+ error due to not allocating enough space for scrollbars.
-rw-r--r--doc/ScintillaHistory.html1
-rw-r--r--gtk/ScintillaGTK.cxx17
2 files changed, 13 insertions, 5 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 2f5e79bf2..91787e7aa 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -532,6 +532,7 @@
<li>
Fixed bugs when used on GTK+ 3.20.
<a href="http://sourceforge.net/p/scintilla/bugs/1825/">Bug #1825</a>.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1831/">Bug #1831</a>.
</li>
<li>
Fix SciTE search field background with dark theme on GTK+ 2.x.
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 5bb20b724..ab6432deb 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -1736,14 +1736,21 @@ void ScintillaGTK::Resize(int width, int height) {
//Platform::DebugPrintf("Resize %d %d\n", width, height);
//printf("Resize %d %d\n", width, height);
+ // GTK+ 3 warns when we allocate smaller than the minimum allocation,
+ // so we use these variables to store the minimum scrollbar lengths.
+ int minVScrollBarHeight, minHScrollBarWidth;
+
// Not always needed, but some themes can have different sizes of scrollbars
#if GTK_CHECK_VERSION(3,0,0)
- GtkRequisition requisition;
- gtk_widget_get_preferred_size(PWidget(scrollbarv), NULL, &requisition);
+ GtkRequisition minimum, requisition;
+ gtk_widget_get_preferred_size(PWidget(scrollbarv), &minimum, &requisition);
+ minVScrollBarHeight = minimum.height;
verticalScrollBarWidth = requisition.width;
- gtk_widget_get_preferred_size(PWidget(scrollbarh), NULL, &requisition);
+ gtk_widget_get_preferred_size(PWidget(scrollbarh), &minimum, &requisition);
+ minHScrollBarWidth = minimum.height;
horizontalScrollBarHeight = requisition.height;
#else
+ minVScrollBarHeight = minHScrollBarWidth = 1;
verticalScrollBarWidth = GTK_WIDGET(PWidget(scrollbarv))->requisition.width;
horizontalScrollBarHeight = GTK_WIDGET(PWidget(scrollbarh))->requisition.height;
#endif
@@ -1757,7 +1764,7 @@ void ScintillaGTK::Resize(int width, int height) {
gtk_widget_show(GTK_WIDGET(PWidget(scrollbarh)));
alloc.x = 0;
alloc.y = height - horizontalScrollBarHeight;
- alloc.width = Platform::Maximum(1, width - verticalScrollBarWidth);
+ alloc.width = Platform::Maximum(minHScrollBarWidth, width - verticalScrollBarWidth);
alloc.height = horizontalScrollBarHeight;
gtk_widget_size_allocate(GTK_WIDGET(PWidget(scrollbarh)), &alloc);
} else {
@@ -1770,7 +1777,7 @@ void ScintillaGTK::Resize(int width, int height) {
alloc.x = width - verticalScrollBarWidth;
alloc.y = 0;
alloc.width = verticalScrollBarWidth;
- alloc.height = Platform::Maximum(1, height - horizontalScrollBarHeight);
+ alloc.height = Platform::Maximum(minVScrollBarHeight, height - horizontalScrollBarHeight);
gtk_widget_size_allocate(GTK_WIDGET(PWidget(scrollbarv)), &alloc);
} else {
gtk_widget_hide(GTK_WIDGET(PWidget(scrollbarv)));