I forgot the actual patch. Here it comes now.

/Roman


Am Montag, den 21.11.2005, 14:34 +0100 schrieb Roman Kennke:
> Hi Mark,
> 
> 
> Am Samstag, den 19.11.2005, 20:04 +0100 schrieb Mark Wielaard:
> > On Tue, 2005-11-15 at 21:23 +0100, Mark Wielaard wrote:
> > > On Tue, 2005-11-15 at 14:16 +0000, Roman Kennke wrote:
> > > > 2005-11-15  Roman Kennke  <[EMAIL PROTECTED]>
> > > > 
> > > >         * javax/swing/JViewport.java
> > > >         (JViewport): Recognize setting of a system property
> > > >         gnu.javax.swing.JViewport for the scrollMode.
> > > > 
> > > > --- javax/swing/JViewport.java  27 Oct 2005 17:20:22 -0000      1.34
> > > > +++ javax/swing/JViewport.java  15 Nov 2005 14:12:41 -0000
> > > > @@ -246,7 +246,18 @@
> > > >    public JViewport()
> > > >    {
> > > >      setOpaque(true);
> > > > -    setScrollMode(BLIT_SCROLL_MODE);
> > > > +    String scrollModeProp =
> > > > +      System.getProperty("gnu.javax.swing.JViewport.scrollMode",
> > > > +                         "BLIT");
> > > 
> > > You want to use gnu.classpath.SystemProperties.getProperty() here for
> > > the (admittedly unlikely) case a JViewport is instantiated through code
> > > that doesn't have enough permissions for reading that system property.
> > > 
> > > It might also be an idea to make scrollModeProp static and only
> > > instantiate it once for efficiency. Although that might be an
> > > optimization that isn't really worth it since I guess instantiating
> > > JViewPorts isn't don't that often. And it would prevent changing this
> > > programmaticaly per instance of course. If that is desirable.
> > 
> > Ping. Any comments?
> 
> I fixed this with the attached patch.
> 
> 2005-11-21  Roman Kennke  <[EMAIL PROTECTED]>
> 
>         * javax/swing/JViewport.java
>         (static_initializer): Initialize the defaultScrollMode here.
>         (JViewport): Set the defaultScrollMode that was initialized in
>         the static initializer.
> 
> /Roman
> 
> _______________________________________________
> Classpath-patches mailing list
> Classpath-patches@gnu.org
> http://lists.gnu.org/mailman/listinfo/classpath-patches
Index: javax/swing/JViewport.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JViewport.java,v
retrieving revision 1.34
retrieving revision 1.36
diff -u -r1.34 -r1.36
--- javax/swing/JViewport.java	27 Oct 2005 17:20:22 -0000	1.34
+++ javax/swing/JViewport.java	21 Nov 2005 13:33:06 -0000	1.36
@@ -38,6 +38,8 @@
 
 package javax.swing;
 
+import gnu.classpath.SystemProperties;
+
 import java.awt.Component;
 import java.awt.Dimension;
 import java.awt.Graphics;
@@ -163,7 +165,13 @@
   public static final int BACKINGSTORE_SCROLL_MODE = 2;
 
   private static final long serialVersionUID = -6925142919680527970L;
-  
+
+  /**
+   * The default scrollmode to be used by all JViewports as determined by
+   * the system property gnu.javax.swing.JViewport.scrollMode.
+   */
+  private static final int defaultScrollMode;
+
   protected boolean scrollUnderway;
   protected boolean isViewSizeSet;
 
@@ -243,10 +251,27 @@
    */
   boolean sizeChanged = true;
 
+  /**
+   * Initializes the default setting for the scrollMode property.
+   */
+  static
+  {
+    String scrollModeProp =
+      SystemProperties.getProperty("gnu.javax.swing.JViewport.scrollMode",
+                         "BLIT");
+    int myScrollMode;
+    if (scrollModeProp.equalsIgnoreCase("simple"))
+      defaultScrollMode = SIMPLE_SCROLL_MODE;
+    else if (scrollModeProp.equalsIgnoreCase("backingstore"))
+      defaultScrollMode = BACKINGSTORE_SCROLL_MODE;
+    else
+      defaultScrollMode = BLIT_SCROLL_MODE;
+  }
+
   public JViewport()
   {
     setOpaque(true);
-    setScrollMode(BLIT_SCROLL_MODE);
+    setScrollMode(defaultScrollMode);
     updateUI();
     setLayout(createLayoutManager());
     lastPaintPosition = new Point();

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to