Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [albireo-dev] CleanResizeListener

Hi Gordon,

On 2008-01-27 you wrote:
> I've added a listener (from the SAS contribution) that improves the look 
>   during window resizing. The listener paints the SWT background for the 
> brief period before the embedded AWT frame repaints. It's needed because 
> we use the sun.awt.noerasebackground property to reduce flicker. Because 
> the property only applies to Windows, the listener is only installed on 
> Windows.

Good. I have added a view, TestResizeView, that can be used to test the
resize behaviour. You can either click or drag the mouse in it.


Regarding the sun.awt.noerasebackground, I observe on Windows:
  - In JDK 1.4 and 1.5, without this property, there is a big flickering.
    With this property, no flickering any more.
  - In JDK 1.6 there is no flickering. The property has no visible effect.

I'm adding comments about it (see below).


Regarding the CleanResizeListener, I observe on Windows:
  - In JDK 1.4 and 1.5: It indeed avoids most of the "garbage". But if
    the background colour is not aligned with the contents of the window
    (like here: background grey, contents dark green), the cleaning is
    visually more disturbing than the garbage. This is especially noticeable
    when you click with the mouse in the above test view.
  - In JDK 1.6: There is much less "garbage"; the repaint is quicker.
    The CleanResizeListener's effect is mostly visible as flickering.

Therefore I propose to:
  - Make it possible to turn on/off the CleanResizeListener, on a per-instance
    basis (since it depends on the contents of the window),
  - Document that it should be enabled only after a background colour has been
    set that approximately matches the window's contents.
  - Add a boolean method isCleanResizeRecommended() that returns false in
    JDK 1.6.

How does that sound?

Bruno


Index: src/org/eclipse/albireo/core/AwtEnvironment.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.albireo/org.eclipse.albireo.core/src/org/eclipse/albireo/core/AwtEnvironment.java,v
retrieving revision 1.5
diff -c -3 -r1.5 AwtEnvironment.java
*** src/org/eclipse/albireo/core/AwtEnvironment.java    1 Feb 2008 19:15:35 -0000       1.5
--- src/org/eclipse/albireo/core/AwtEnvironment.java    11 Feb 2008 20:52:03 -0000
***************
*** 114,122 ****
          
          /*
           * This property removes a large amount of flicker from embedded swing
!          * components. Ideally it would be set lazily,
           * but since its value is read once and cached by AWT, it needs
           * to be set before any AWT/Swing APIs are called.
           */       
          // TODO: this is effective only on Windows.
          System.setProperty("sun.awt.noerasebackground", "true"); //$NON-NLS-1$//$NON-NLS-2$
--- 114,123 ----
          
          /*
           * This property removes a large amount of flicker from embedded swing
!          * components in JDK 1.4 and 1.5. Ideally it would be set lazily,
           * but since its value is read once and cached by AWT, it needs
           * to be set before any AWT/Swing APIs are called.
+          * This setting is no longer needed in JDK 1.6.
           */       
          // TODO: this is effective only on Windows.
          System.setProperty("sun.awt.noerasebackground", "true"); //$NON-NLS-1$//$NON-NLS-2$


Back to the top