X Tutup
Skip to content

Commit ec55fee

Browse files
author
soheil_h_y
committed
1. Ascynchronous layout!
1 parent fd6b829 commit ec55fee

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,7 @@ void updateLayout (boolean resize, boolean all) {
10091009
state &= ~(LAYOUT_NEEDED | LAYOUT_CHANGED);
10101010
if (resize) setResizeChildren (false);
10111011
// layout.layout (this, changed);
1012+
this.waintingForLayout = true;
10121013
display.sendMessage(new MESSAGE(this, MESSAGE.CONTROL_LAYOUT, new boolean[] {resize, all}));
10131014
if (resize) setResizeChildren (true);
10141015
}

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@
1212
package org.eclipse.swt.widgets;
1313

1414

15-
import java.util.ArrayList;
1615
import java.util.Date;
17-
import java.util.List;
1816

1917
import org.eclipse.swt.SWT;
2018
import org.eclipse.swt.SWTException;
21-
import org.eclipse.swt.custom.StackLayout;
2219
import org.eclipse.swt.graphics.Color;
2320
import org.eclipse.swt.graphics.Cursor;
2421
import org.eclipse.swt.graphics.Device;
@@ -2933,7 +2930,7 @@ public boolean readAndDispatch () {
29332930
public void run() {
29342931
// System.out.println("I'm entering the run");
29352932
// System.out.println("msg " + Display.this.msgs);
2936-
List layoutQueue = new ArrayList();
2933+
// List layoutQueue = new ArrayList();
29372934
MESSAGE[] msgs = Display.this.msgs;
29382935
if (msgs.length != 0) {
29392936
System.out.println("msgs.legnth" + msgs.length);
@@ -2954,10 +2951,9 @@ public void run() {
29542951
}
29552952

29562953
if(m1.type == MESSAGE.CONTROL_LAYOUT){
2957-
if(layoutQueue.contains(m1.control.parent)){
2954+
if(m1.control.parent != null && m1.control.parent.waintingForLayout){
29582955
msgs[i] = null;
29592956
}
2960-
layoutQueue.add(m1);
29612957
}
29622958

29632959
}
@@ -2968,6 +2964,7 @@ public void run() {
29682964
MESSAGE m = msgs[i];
29692965
msgs[i] = null;
29702966
if (m != null && m.type == MESSAGE.CONTROL_LAYOUT) {
2967+
m.control.waintingForLayout = false;
29712968
if (!m.control.isVisible()) { continue; }
29722969
Date d = new Date();
29732970
Composite c = (Composite) m.control;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public abstract class Widget {
7171
boolean dragStatus;
7272
long hoverTime;
7373
int hoverTimerID;
74-
74+
boolean waintingForLayout;
7575
boolean[] hookedStatus;
7676

7777
/* Global state flags */
@@ -142,6 +142,7 @@ public Widget (Widget parent, int style) {
142142
checkParent (parent);
143143
this.style = style;
144144
display = parent.display;
145+
waintingForLayout = false;
145146
}
146147

147148
/**

0 commit comments

Comments
 (0)
X Tutup