Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimeon Andreev2018-04-30 12:21:13 +0000
committerSimeon Andreev2018-04-30 14:48:07 +0000
commitfaeeb9254a8dea23c4285ac820bf2d4023a13272 (patch)
tree8c86c8b409bf837acb266a0948b53ba35bb3d4dc /bundles
parentd9f5632d5ad407acb871d32f4f2af1099f6c9bf9 (diff)
downloadeclipse.platform.swt-faeeb9254a8dea23c4285ac820bf2d4023a13272.tar.gz
eclipse.platform.swt-faeeb9254a8dea23c4285ac820bf2d4023a13272.tar.xz
eclipse.platform.swt-faeeb9254a8dea23c4285ac820bf2d4023a13272.zip
Bug 534204 - [GTK3] Scale with GridLayout height hint has no line
An SWT Scale for which a low height hint is specified via GridData does not show its line on GTK 3.22. It only shows its trough. This is also observed when the parent of the Scale has a GridLayout and has a small enough size (e.g. due to resizing). This change ensures the scale is never reduced to below 26px. Resizing of the scale is not impacted, since the GTK scale resides in an SWT fixed which can still be resized at will. When resized below 26px, parts of the scale start to become not visible. Change-Id: I5d0b18783b5f126ca2fee6918b885480cbcb977e Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java
index edacb4f8bf..f9bed26d71 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java
@@ -380,4 +380,24 @@ long /*int*/ gtk_scale_new (int orientation, long /*int*/ adjustment) {
}
return scale;
}
+
+@Override
+Point resizeCalculationsGTK3(long /*int*/ widget, int width, int height) {
+ Point size = super.resizeCalculationsGTK3(widget, width, height);
+ /*
+ * Bug 534204: (GTK 3.22) Scale with GridLayout height hint has no line
+ *
+ * Specifying a too low height hint for a scale, or shrinking the scale too much
+ * can result in a missing line for the scale. We specify a minimum height to avoid this.
+ * Due to the parent SwtFixed, the scale widget can still be resized below this minimum size.
+ * Instead of shrinking to comply with the too-small size, parts of it are hidden.
+ */
+ if (widget == handle && GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ GtkRequisition naturalSize = new GtkRequisition();
+ GtkRequisition minimumSize = new GtkRequisition();
+ GTK.gtk_widget_get_preferred_size(handle, minimumSize, naturalSize);
+ size.y = Math.max(size.y, minimumSize.height);
+ }
+ return size;
+}
}

Back to the top