diff options
| author | Sravan Kumar Lakkimsetti | 2014-04-14 11:38:29 +0000 |
|---|---|---|
| committer | Alexander Kurtakov | 2014-04-22 21:09:17 +0000 |
| commit | 8c8ff931eaefa50624561858afae1e6147ac41ae (patch) | |
| tree | 431161a343ddbdd25148fed63d6db491361d68b5 | |
| parent | cf5354a3df99e586e64648537cfe0b3e4fe894f1 (diff) | |
| download | eclipse.platform.swt-8c8ff931eaefa50624561858afae1e6147ac41ae.tar.gz eclipse.platform.swt-8c8ff931eaefa50624561858afae1e6147ac41ae.tar.xz eclipse.platform.swt-8c8ff931eaefa50624561858afae1e6147ac41ae.zip | |
Bug 432115 - [GTK3] Window is very limited when switching between
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.java | 17 | ||||
| -rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java | 15 |
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 42e8d2a05c..f1f44411d0 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 8c0b86825f..e61b299540 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; |
