[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [albireo-dev] inhibitSizePropagationToAWT
|
Gordon Hirsch wrote:
> On Windows, I'm currently
> seeing no size propagation to AWT. Frequently, this has the result seen
> in the attached screenshots.
I reproduce it (on Windows, not on Linux). To ease debugging - I don't
want to comment in and comment out half a dozen of printlns each time I
have to debug a problem with the size propagation - I'm introducing a
'static final boolean' variable. It generates no code when the variable is
set to false.
Bruno
Index: src/org/eclipse/albireo/core/SwingControl.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.albireo/org.eclipse.albireo.core/src/org/eclipse/albireo/core/SwingControl.java,v
retrieving revision 1.26
diff -c -3 -r1.26 SwingControl.java
*** src/org/eclipse/albireo/core/SwingControl.java 12 Feb 2008 14:06:59 -0000 1.26
--- src/org/eclipse/albireo/core/SwingControl.java 12 Feb 2008 14:47:05 -0000
***************
*** 44,49 ****
--- 44,53 ----
public abstract class SwingControl extends Composite {
+ // Whether to print debugging information regarding size propagation
+ // and layout.
+ private static final boolean verboseSizeLayout = false;
+
private Listener settingsListener = new Listener() {
public void handleEvent(Event event) {
handleSettingsChange();
***************
*** 363,369 ****
*/
protected void updateCachedAWTSizes(final Dimension min, final Dimension pref, final Dimension max) {
assert EventQueue.isDispatchThread(); // On AWT event thread
! // System.out.println("Updated component sizes from AWT: " + min + " <= " + pref + " <= " + max);
boolean mustNotify;
synchronized (this) {
--- 367,374 ----
*/
protected void updateCachedAWTSizes(final Dimension min, final Dimension pref, final Dimension max) {
assert EventQueue.isDispatchThread(); // On AWT event thread
! if (verboseSizeLayout)
! System.err.println("AWT thread: updated component sizes: " + min + " <= " + pref + " <= " + max);
boolean mustNotify;
synchronized (this) {
***************
*** 386,392 ****
// sizes can be taken into account.
ThreadingHandler.getInstance().asyncExec(display, new Runnable() {
public void run() {
! // System.out.println("Laying out after size update");
if (!isDisposed()) {
try {
inhibitSizePropagationToAWT = true;
--- 391,398 ----
// sizes can be taken into account.
ThreadingHandler.getInstance().asyncExec(display, new Runnable() {
public void run() {
! if (verboseSizeLayout)
! System.err.println("AWT->SWT thread: Laying out after size update");
if (!isDisposed()) {
try {
inhibitSizePropagationToAWT = true;
***************
*** 427,436 ****
protected void setAWTSize(final int width, final int height) {
assert Display.getCurrent() != null; // On SWT event thread
! // System.out.println("Setting size from SWT: " + width + " x " + height + " for " + swingComponent);
EventQueue.invokeLater(
new Runnable() {
public void run() {
if (frame != null) {
frame.setBounds(0, 0, Math.max(width, 0), Math.max(height, 0));
frame.validate();
--- 433,445 ----
protected void setAWTSize(final int width, final int height) {
assert Display.getCurrent() != null; // On SWT event thread
! if (verboseSizeLayout)
! System.err.println("SWT thread: Preparing to set size: " + width + " x " + height + " for " + swingComponent);
EventQueue.invokeLater(
new Runnable() {
public void run() {
+ if (verboseSizeLayout)
+ System.err.println("SWT->AWT thread: Setting size: " + width + " x " + height + " for " + swingComponent);
if (frame != null) {
frame.setBounds(0, 0, Math.max(width, 0), Math.max(height, 0));
frame.validate();
***************
*** 445,450 ****
--- 454,461 ----
protected void handleSetBounds(int width, int height) {
assert Display.getCurrent() != null; // On SWT event thread
checkPopulated();
+ if (verboseSizeLayout)
+ System.err.println("SWT thread: setBounds called: "+width+" x "+height);
// Pass on the desired size to the embedded component, but only if it could
// be reasonably calculated (i.e. we have cached preferred sizes) and if
// computeSize took it into account.
***************
*** 482,488 ****
boolean initialized = getCachedAWTSizes(min, pref, max);
if (!initialized) {
! // System.out.println("Uninitialized AWT sizes for " + swingComponent);
return super.computeSize(widthHint, heightHint, changed);
} else {
assert cachedSizesInitialized >= 1;
--- 493,500 ----
boolean initialized = getCachedAWTSizes(min, pref, max);
if (!initialized) {
! if (verboseSizeLayout)
! System.err.println("SWT thread: Uninitialized AWT sizes for " + swingComponent);
return super.computeSize(widthHint, heightHint, changed);
} else {
assert cachedSizesInitialized >= 1;
***************
*** 499,505 ****
heightHint < min.width ? min.height :
heightHint > max.width ? max.height :
heightHint);
! // System.out.println("Computed size from SWT: " + width + " x " + height + " for " + swingComponent);
return new Point(width, height);
}
}
--- 511,518 ----
heightHint < min.width ? min.height :
heightHint > max.width ? max.height :
heightHint);
! if (verboseSizeLayout)
! System.err.println("SWT thread: Computed size: " + width + " x " + height + " for " + swingComponent);
return new Point(width, height);
}
}