jdk/src/solaris/classes/sun/awt/X11/XWindow.java
changeset 21270 8a0fc12b81a2
parent 18178 ee71c923891d
child 21278 ef8a3a2a72f2
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Wed Oct 23 16:24:50 2013 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Thu Oct 24 14:32:07 2013 +0400
@@ -32,7 +32,6 @@
 
 import java.lang.ref.WeakReference;
 
-import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 
 import sun.util.logging.PlatformLogger;
@@ -491,33 +490,31 @@
     public boolean isEmbedded() {
         return embedded;
     }
-    public  void repaint(int x,int y, int width, int height) {
+
+    public final void repaint(int x, int y, int width, int height) {
         if (!isVisible() || getWidth() == 0 || getHeight() == 0) {
             return;
         }
         Graphics g = getGraphics();
         if (g != null) {
             try {
-                g.setClip(x,y,width,height);
-                paint(g);
+                g.setClip(x, y, width, height);
+                if (SunToolkit.isDispatchThreadForAppContext(getTarget())) {
+                    paint(g); // The native and target will be painted in place.
+                } else {
+                    paintPeer(g);
+                    postPaintEvent(target, x, y, width, height);
+                }
             } finally {
                 g.dispose();
             }
         }
     }
+
     void repaint() {
-        if (!isVisible() || getWidth() == 0 || getHeight() == 0) {
-            return;
-        }
-        final Graphics g = getGraphics();
-        if (g != null) {
-            try {
-                paint(g);
-            } finally {
-                g.dispose();
-            }
-        }
+        repaint(0, 0, getWidth(), getHeight());
     }
+
     public void paint(final Graphics g) {
         // paint peer
         paintPeer(g);
@@ -558,11 +555,11 @@
             && compAccessor.getWidth(target) != 0
             && compAccessor.getHeight(target) != 0)
         {
-            handleExposeEvent(target, x, y, w, h);
+            postPaintEvent(target, x, y, w, h);
         }
     }
 
-    public void handleExposeEvent(Component target, int x, int y, int w, int h) {
+    public void postPaintEvent(Component target, int x, int y, int w, int h) {
         PaintEvent event = PaintEventDispatcher.getPaintEventDispatcher().
             createPaintEvent(target, x, y, w, h);
         if (event != null) {