03adf48
From 7db3fba25fe89240fa80661d81a5dffa2f31ff14 Mon Sep 17 00:00:00 2001
03adf48
From: Alexander Kurtakov
03adf48
Date: Mon, 12 Oct 2015 19:08:43 +0300
03adf48
Subject: Bug 479580 - Widgets with V_SCROLL not scrollable
03adf48
03adf48
Hiding scrollbar for widget created with style V_SCROLL shouldn't stop
03adf48
other means of scrolling e.g. mouse wheel.
03adf48
The fix is to use new GTK_POLICY_EXTERNAL (added in GTK 3.16) which
03adf48
allows scrolling when scrollbars invisible which was not the possible
03adf48
before that.
03adf48
03adf48
Change-Id: Icffb3c7792458369a7a7ee07dc317d83bf0757b2
03adf48
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
03adf48
---
03adf48
 .../Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java            | 1 +
03adf48
 .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java            | 3 +++
03adf48
 2 files changed, 4 insertions(+)
03adf48
03adf48
diff --git a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
03adf48
index fe8283d..cf8cda6 100644
03adf48
--- a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java	
03adf48
+++ b/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java	
03adf48
@@ -363,6 +363,7 @@ public class OS extends C {
03adf48
 	public static final int GTK_POLICY_ALWAYS = 0x0;
03adf48
 	public static final int GTK_POLICY_AUTOMATIC = 0x1;
03adf48
 	public static final int GTK_POLICY_NEVER = 0x2;
03adf48
+	public static final int GTK_POLICY_EXTERNAL = 0x3;
03adf48
 	public static final int GTK_POS_TOP = 0x2;
03adf48
 	public static final int GTK_POS_BOTTOM = 0x3;
03adf48
 	public static final int GTK_PRINT_CAPABILITY_PAGE_SET     = 1 << 0;
03adf48
diff --git a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
03adf48
index 2d38a95..7295a27 100644
03adf48
--- a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java	
03adf48
+++ b/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java	
03adf48
@@ -389,6 +389,9 @@ boolean setScrollBarVisible (ScrollBar bar, boolean visible) {
03adf48
 	int [] hsp = new int [1], vsp = new int [1];
03adf48
 	OS.gtk_scrolled_window_get_policy (scrolledHandle, hsp, vsp);
03adf48
 	int policy = visible ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_NEVER;
03adf48
+	if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0) && !visible) {
03adf48
+		policy = OS.GTK_POLICY_EXTERNAL;
03adf48
+	}
03adf48
 	if ((bar.style & SWT.HORIZONTAL) != 0) {
03adf48
 		if (hsp [0] == policy) return false;
03adf48
 		hsp [0] = policy;
03adf48
-- 
03adf48
cgit v0.11.2-4-g4a35
03adf48