summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Heidrich <fheidric>2004-12-01 18:48:33 +0000
committerFelipe Heidrich <fheidric>2004-12-01 18:48:33 +0000
commitd6e73574e552f265f3541ca90078668e479b7cf1 (patch)
tree6216f379007b026d0c3a1d6d073040d963117728
parent6342d60ee241e531740db13f1e8f8d595ad76a9f (diff)
downloadeclipse.platform.swt-d6e73574e552f265f3541ca90078668e479b7cf1.tar.gz
eclipse.platform.swt-d6e73574e552f265f3541ca90078668e479b7cf1.tar.xz
eclipse.platform.swt-d6e73574e552f265f3541ca90078668e479b7cf1.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index 74c190e50c..bf40fc770b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -1468,14 +1468,9 @@ public Monitor getPrimaryMonitor () {
*/
public Shell [] getShells () {
checkDevice ();
- int length = 0;
- for (int i=0; i<widgetTable.length; i++) {
- Widget widget = widgetTable [i];
- if (widget != null && widget instanceof Shell) length++;
- }
- int index = 0;
+ int length = 4, index = 0;
Shell [] result = new Shell [length];
- for (int i=0; i<widgetTable.length; i++) {
+ for (int i = 0; i < widgetTable.length; i++) {
Widget widget = widgetTable [i];
if (widget != null && widget instanceof Shell) {
int j = 0;
@@ -1483,7 +1478,14 @@ public Shell [] getShells () {
if (result [j] == widget) break;
j++;
}
- if (j == index) result [index++] = (Shell) widget;
+ if (j == index) {
+ if (index == result.length) {
+ Shell [] newResult = new Shell [index + 4];
+ System.arraycopy (result, 0, newResult, 0, index);
+ result = newResult;
+ }
+ result [index++] = (Shell) widget;
+ }
}
}
if (index == length) return result;