harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r472118 - in /incubator/harmony/enhanced/classlib/trunk/modules: awt/src/main/java/common/java/awt/ awt/src/main/java/common/org/apache/harmony/awt/ swing/src/main/java/common/org/apache/harmony/x/swing/
Date Tue, 07 Nov 2006 13:55:55 GMT
Author: apetrenko
Date: Tue Nov  7 05:55:54 2006
New Revision: 472118

URL: http://svn.apache.org/viewvc?view=rev&rev=472118
Log:
Patch for HARMONY-1865 "[classlib][swing] Non-topmost JInternalFrame is painted incorrectly
after movement"

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Container.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Toolkit.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/ComponentInternals.java
    incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/BlitSupport.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java?view=diff&rev=472118&r1=472117&r2=472118
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java
Tue Nov  7 05:55:54 2006
@@ -4168,7 +4168,9 @@
         r.translate(x, y);
         MultiRectArea ret = parent.getObscuredRegion(r);
         if (ret != null) {
+            parent.addObscuredRegions(ret, this);
             ret.translate(-x, -y);
+            ret.intersect(new Rectangle(0, 0, w, h));
         }
         return ret;
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Container.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Container.java?view=diff&rev=472118&r1=472117&r2=472118
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Container.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Container.java
Tue Nov  7 05:55:54 2006
@@ -35,6 +35,8 @@
 
 import org.apache.harmony.awt.internal.nls.Messages;
 
+import org.apache.harmony.awt.gl.MultiRectArea;
+
 public class Container extends Component {
     private static final long serialVersionUID = 4613797578919906343L;
 
@@ -1411,5 +1413,29 @@
             container = container.getFocusCycleRootAncestor();
         }
         return (container == root) ? root : null;
+    }
+
+    /**
+     * Adds parts obscured by components which
+     * are above the given component
+     * in this container to mra
+     * @param mra MultiRectArea to add regions to
+     * @param component obscured regions of this component are added
+     */
+    void addObscuredRegions(MultiRectArea mra, Component component) {
+        int z = getComponentZOrder(component);
+        int i;
+        for (i = 0; i < z; i++) {
+            Component comp = getComponent(i);
+            if (comp.isDisplayable()&& comp.isVisible()&& comp.isOpaque())
{
+                mra.add(comp.getBounds());
+            }
+        }
+        for (i = z + 1; i < getComponentCount(); i++) {
+            Component comp = getComponent(i);
+            if (comp.isVisible() && !comp.isLightweight()) {
+                mra.add(comp.getBounds());
+            }
+        }
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Toolkit.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Toolkit.java?view=diff&rev=472118&r1=472117&r2=472118
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Toolkit.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Toolkit.java
Tue Nov  7 05:55:54 2006
@@ -368,6 +368,13 @@
         public void setVisibleFlag(Component comp, boolean visible) {
             comp.visible = visible;
         }
+
+        @Override
+        public void addObscuredRegions(MultiRectArea mra, Component c, Container container)
{
+            if (container != null) {
+                container.addObscuredRegions(mra, c);
+            }            
+        }
     }
 
     /*
@@ -542,7 +549,7 @@
                 public WTK init() {
                     wtk = createWTK(className);
                     wtk.getNativeEventQueue().setShutdownWatchdog(shutdownWatchdog);
-                    synchronizer.setEnvironment(wtk, nativeThread);
+                    synchronizer.setEnvironment(wtk, dispatchThread);
                     ContextStorage.setWTK(wtk);
                     dtk.initDragAndDrop();
                     return wtk;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/ComponentInternals.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/ComponentInternals.java?view=diff&rev=472118&r1=472117&r2=472118
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/ComponentInternals.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/ComponentInternals.java
Tue Nov  7 05:55:54 2006
@@ -21,6 +21,7 @@
 package org.apache.harmony.awt;
 
 import java.awt.Component;
+import java.awt.Container;
 import java.awt.Dialog;
 import java.awt.Dimension;
 import java.awt.Image;
@@ -178,6 +179,13 @@
      * heavyweight components overlapping with passed component
      */
     public abstract MultiRectArea getObscuredRegion(Component c);
+    
+    /**
+     * An accessor to Container.addObscuredRegions() method
+     * @see java.awt.Container#addObscuredRegions(MultiRectArea, Component)
+     */
+    public abstract void addObscuredRegions(MultiRectArea mra, Component c,
+                                            Container container);
     
     /**
      * Makes it possible to call protected Toolkit.setDesktopProperty()

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/BlitSupport.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/BlitSupport.java?view=diff&rev=472118&r1=472117&r2=472118
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/BlitSupport.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/BlitSupport.java
Tue Nov  7 05:55:54 2006
@@ -20,6 +20,7 @@
  */
 package org.apache.harmony.x.swing;
 
+import java.awt.Component;
 import java.awt.Container;
 import java.awt.EventQueue;
 import java.awt.Graphics;
@@ -92,10 +93,6 @@
         }
 
         Rectangle parentBounds = parent.getVisibleRect();
-        if (Utilities.getDrawingRoot(parent, parentBounds) != parent) {
-            resetBlitting();
-            return false;
-        }
 
         Graphics g = parent.getGraphics();
         if (g == null) {
@@ -189,7 +186,9 @@
     }
 
     private boolean isObscured(final int x, final int y, final int width, final int height)
{
-        MultiRectArea obscuredArea = ComponentInternals.getComponentInternals().getObscuredRegion(parent);
+        ComponentInternals ci = ComponentInternals.getComponentInternals();
+        MultiRectArea obscuredArea = ci.getObscuredRegion(parent);
+        ci.addObscuredRegions(obscuredArea, blitingComponent, parent);
         if (obscuredArea == null || obscuredArea.isEmpty()) {
             return false;
         }



Mime
View raw message