aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <nyamatongwe@gmail.com>2013-06-18 16:18:59 +1000
committernyamatongwe <nyamatongwe@gmail.com>2013-06-18 16:18:59 +1000
commit5ee0ab551779485a46afc18dbe1a5880560a9995 (patch)
tree7b773ec7591e44f32cbb065a0b1e9c1bfeda6ac4
parenta51c4a5b838f7c6b30d06032ec472ef6d97f17ec (diff)
downloadscintilla-mirror-5ee0ab551779485a46afc18dbe1a5880560a9995.tar.gz
Bug: [#1488] Simplify gtk scrollbar resize code.
From Todd Whiteman at ActiveState.
-rw-r--r--gtk/ScintillaGTK.cxx13
1 files changed, 3 insertions, 10 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 49cf2c8cd..2d82d5af6 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -1693,9 +1693,6 @@ void ScintillaGTK::Resize(int width, int height) {
// These allocations should never produce negative sizes as they would wrap around to huge
// unsigned numbers inside GTK+ causing warnings.
bool showSBHorizontal = horizontalScrollBarVisible && (wrapState == eWrapNone);
- int horizontalScrollBarHeight = scrollBarHeight;
- if (!showSBHorizontal)
- horizontalScrollBarHeight = 0;
GtkAllocation alloc;
if (showSBHorizontal) {
@@ -1703,10 +1700,11 @@ void ScintillaGTK::Resize(int width, int height) {
alloc.x = 0;
alloc.y = height - scrollBarHeight;
alloc.width = Platform::Maximum(1, width - scrollBarWidth);
- alloc.height = horizontalScrollBarHeight;
+ alloc.height = scrollBarHeight;
gtk_widget_size_allocate(GTK_WIDGET(PWidget(scrollbarh)), &alloc);
} else {
gtk_widget_hide(GTK_WIDGET(PWidget(scrollbarh)));
+ scrollBarHeight = 0; // in case horizontalScrollBarVisible is true.
}
if (verticalScrollBarVisible) {
@@ -1715,11 +1713,10 @@ void ScintillaGTK::Resize(int width, int height) {
alloc.y = 0;
alloc.width = scrollBarWidth;
alloc.height = Platform::Maximum(1, height - scrollBarHeight);
- if (!showSBHorizontal)
- alloc.height += scrollBarWidth-1;
gtk_widget_size_allocate(GTK_WIDGET(PWidget(scrollbarv)), &alloc);
} else {
gtk_widget_hide(GTK_WIDGET(PWidget(scrollbarv)));
+ scrollBarWidth = 0;
}
if (IS_WIDGET_MAPPED(PWidget(wMain))) {
ChangeSize();
@@ -1729,10 +1726,6 @@ void ScintillaGTK::Resize(int width, int height) {
alloc.y = 0;
alloc.width = Platform::Maximum(1, width - scrollBarWidth);
alloc.height = Platform::Maximum(1, height - scrollBarHeight);
- if (!showSBHorizontal)
- alloc.height += scrollBarHeight;
- if (!verticalScrollBarVisible)
- alloc.width += scrollBarWidth;
gtk_widget_size_allocate(GTK_WIDGET(PWidget(wText)), &alloc);
}