From c3dbfa97fdca42af33f99ca9451ee30d568ddacb Mon Sep 17 00:00:00 2001 From: Aleksandar Kurtakov Date: Fri, 8 Aug 2025 12:39:13 +0300 Subject: [PATCH] [Gtk] Use foreach Make the code slightly more readable --- .../gtk/org/eclipse/swt/widgets/Canvas.java | 4 +- .../org/eclipse/swt/widgets/Composite.java | 86 +++++++------------ .../swt/examples/controlexample/Tab.java | 3 +- 3 files changed, 33 insertions(+), 60 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java index 5142e0ccb67..d123429a5d5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java @@ -425,9 +425,7 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b Cairo.cairo_region_destroy (copyRegion); Cairo.cairo_region_destroy (invalidateRegion); if (all) { - Control [] children = _getChildren (); - for (int i=0; i= Math.max (x, rect.x) && Math.min(y + height, rect.y + rect.height) >= Math.max (y, rect.y)) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java index 62ff8929e0e..7000057be43 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java @@ -445,8 +445,7 @@ void fixClippings () { if (fixClipHandle == 0 || fixClipMap.isEmpty()) { return; } else { - Control [] children = _getChildren(); - for (Control child : children) { + for (Control child : _getChildren()) { if (fixClipMap.containsKey(child)) { long [] childHandles = fixClipMap.get(child); for (long widget : childHandles) { @@ -604,9 +603,7 @@ Composite findDeferredControl () { Menu [] findMenus (Control control) { if (control == this) return new Menu [0]; Menu result [] = super.findMenus (control); - Control [] children = _getChildren (); - for (int i=0; i