Skip to content

Commit aedff93

Browse files
author
soheil_h_y
committed
1. Asyncronous layout bug is solved!
1 parent cfcef3d commit aedff93

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Composite.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class Composite extends Scrollable {
5454
Control [] tabList;
5555
int layoutCount = 0;
5656
// Control [] children = new Control[0];
57-
Control [] children;
57+
protected Control [] children;
5858
boolean waitingForLayoutWithResize;
5959

6060
/**
@@ -1017,25 +1017,23 @@ protected boolean SetWindowPos(Object hWnd, Object hWndInsertAfter, int X, int Y
10171017

10181018
void updateLayout (boolean resize, boolean all) {
10191019
if (isLayoutDeferred ()) return;
1020-
if ((state & LAYOUT_NEEDED) != 0) {
1021-
boolean changed = (state & LAYOUT_CHANGED) != 0;
1022-
state &= ~(LAYOUT_NEEDED | LAYOUT_CHANGED);
1020+
1021+
if ((state & LAYOUT_NEEDED) != 0 && !waitingForLayout) {
1022+
// boolean changed = (state & LAYOUT_CHANGED) != 0;
1023+
// state &= ~(LAYOUT_NEEDED | LAYOUT_CHANGED);
10231024
// if (resize) setResizeChildren (false);
10241025
// layout.layout (this, changed);
10251026
this.waitingForLayout = true;
10261027
this.waitingForLayoutWithResize = resize;
10271028
display.sendMessage(new MESSAGE(this, MESSAGE.CONTROL_LAYOUT, new boolean[] {resize, all}));
1028-
// if (resize) setResizeChildren (true);
10291029
}
10301030

10311031

10321032
if (all) {
10331033
Control [] children = _getChildren ();
10341034
int length = children.length;
10351035
for (int i=0; i<length; i++) {
1036-
// children [i].updateLayout (resize, all);
10371036
if (children[i] instanceof Composite) {
1038-
// System.out.println("update Layout " + children[i]);
10391037
display.sendMessage(new MESSAGE(children[i], MESSAGE.CONTROL_LAYOUT, new boolean[] {resize, all}));
10401038
}
10411039
}

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Display.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3113,6 +3113,7 @@ public void run() {
31133113
}
31143114
if(c.layout != null){
31153115
c.layout.layout (c, (c.state & Composite.LAYOUT_CHANGED) != 0);
3116+
c.state &= ~(Composite.LAYOUT_NEEDED | Composite.LAYOUT_CHANGED);
31163117
}
31173118
if(c.waitingForLayoutWithResize){
31183119
c.setResizeChildren (true);

0 commit comments

Comments
 (0)