aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSravan Kumar Lakkimsetti2014-04-14 07:38:29 (EDT)
committerAlexander Kurtakov2014-04-22 17:09:17 (EDT)
commit8c8ff931eaefa50624561858afae1e6147ac41ae (patch)
tree431161a343ddbdd25148fed63d6db491361d68b5
parentcf5354a3df99e586e64648537cfe0b3e4fe894f1 (diff)
downloadeclipse.platform.swt-8c8ff931eaefa50624561858afae1e6147ac41ae.zip
eclipse.platform.swt-8c8ff931eaefa50624561858afae1e6147ac41ae.tar.gz
eclipse.platform.swt-8c8ff931eaefa50624561858afae1e6147ac41ae.tar.bz2
Bug 432115 - [GTK3] Window is very limited when switching betweenrefs/changes/56/24956/6
editors or between views Change-Id: I8af98c3afb9321adeee838442f6e2159e3d18819 Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java15
2 files changed, 31 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index 42e8d2a..f1f4441 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -492,6 +492,21 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0;
Point size = computeNativeSize (handle, wHint, hHint, changed);
if (size.x == 0 && wHint == SWT.DEFAULT) size.x = DEFAULT_WIDTH;
+
+ /*
+ * in GTK 3.8 computeNativeSize returning 0 for height.
+ * So if the height is returned as zero calculate the table height
+ * based on the number of items in the table
+ */
+ if (OS.GTK3 && size.y == 0 && hHint == SWT.DEFAULT) {
+ size.y = getItemCount() * getItemHeight();
+ }
+
+ /*
+ * In case the table doesn't contain any elements,
+ * getItemCount returns 0 and size.y will be 0
+ * so need to assign default height
+ */
if (size.y == 0 && hHint == SWT.DEFAULT) size.y = DEFAULT_HEIGHT;
Rectangle trim = computeTrim (0, 0, size.x, size.y);
size.x = trim.width;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index 8c0b868..e61b299 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -548,6 +548,21 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
OS.gtk_widget_realize(handle);
Point size = computeNativeSize (handle, wHint, hHint, changed);
if (size.x == 0 && wHint == SWT.DEFAULT) size.x = DEFAULT_WIDTH;
+
+ /*
+ * in GTK 3.8 computeNativeSize returning 0 for height.
+ * So if the height is returned as zero calculate the tree height
+ * based on the number of items in the table
+ */
+ if (OS.GTK3 && size.y == 0 && hHint == SWT.DEFAULT) {
+ size.y = getItemCount() * getItemHeight();
+ }
+
+ /*
+ * In case the table doesn't contain any elements,
+ * getItemCount returns 0 and size.y will be 0
+ * so need to assign default height
+ */
if (size.y == 0 && hHint == SWT.DEFAULT) size.y = DEFAULT_HEIGHT;
Rectangle trim = computeTrim (0, 0, size.x, size.y);
size.x = trim.width;