Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2017-06-22 14:30:34 +0000
committerEric Williams2017-06-23 15:48:48 +0000
commit6a0d96f4ad875d95bb8371f665998f8c5198d2f5 (patch)
tree56e8d1997c9a22dc64c1dab8769f1e4e73da3275
parent1800fab841ec6ad0f87c28930827f825a36aa9fe (diff)
downloadeclipse.platform.swt-6a0d96f4ad875d95bb8371f665998f8c5198d2f5.tar.gz
eclipse.platform.swt-6a0d96f4ad875d95bb8371f665998f8c5198d2f5.tar.xz
eclipse.platform.swt-6a0d96f4ad875d95bb8371f665998f8c5198d2f5.zip
Bug 486068: [GTK3.20+] Allocation warnings printed in error console
This fix targets the Group widget. GTK3.20+ calculates allocation sizes using GtkCssNode elements which we cannot access. The fix is to calculate the following: to-be-allocated width/height - (difference between the preferred width/height and the to-be-allocated width/height) If the above number is below 0, allocate the preferred width/height. Tested on GTK3.22, 3.20, 3.18, 3.16, 3.10, and 2.24. No additional AllNonBrowser JUnit test failures occur. Change-Id: Ie8e521aa35d3c411411a5ee872ea79c407dd1dce Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
index ea927f2e9f..dd718948b1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
@@ -427,7 +427,6 @@ void showWidget () {
@Override
int setBounds(int x, int y, int width, int height, boolean move, boolean resize) {
-
if (OS.GTK3) {
// Work around for bug 470129.
// See also https://bugzilla.gnome.org/show_bug.cgi?id=754976 :
@@ -436,9 +435,18 @@ int setBounds(int x, int y, int width, int height, boolean move, boolean resize)
// GtkFrame does not handle well allocating less than its minimum size
GtkRequisition requisition = new GtkRequisition();
OS.gtk_widget_get_preferred_size(handle, requisition, null);
- width = Math.max(requisition.width, width);
+ /*
+ * Feature in GTK3.20+: size calculations take into account GtkCSSNode
+ * elements which we cannot access. If the to-be-allocated size minus
+ * these elements is < 0, allocate the preferred size instead.
+ */
+ if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ width = (requisition.width - width) < 0 ? requisition.width : width;
+ height = (requisition.height - height) < 0 ? requisition.height : height;
+ } else {
+ width = Math.max(requisition.width, width);
+ }
}
-
return super.setBounds(x, y, width, height, move, resize);
}

Back to the top