src/macosx/classes/sun/lwawt/LWWindowPeer.java

Print this page

        

@@ -110,10 +110,12 @@
 
     private volatile boolean skipNextFocusChange;
 
     private static final Color nonOpaqueBackground = new Color(0, 0, 0, 0);
 
+    private volatile boolean textured;
+
     /**
      * Current modal blocker or null.
      *
      * Synchronization: peerTreeLock.
      */

@@ -440,13 +442,27 @@
 
     @Override
     public void updateWindow() {
     }
 
+    public final boolean isTextured() {
+        return textured;
+    }
+
+    public final void setTextured(final boolean isTextured) {
+        textured = isTextured;
+    }
+
     public final boolean isTranslucent() {
         synchronized (getStateLock()) {
-            return !isOpaque || isShaped();
+            /*
+             * Textured window is a special case of translucent window.
+             * The difference is only in nswindow background. So when we set
+             * texture property our peer became fully translucent. It doesn't
+             * fill background, create non opaque backbuffers and layer etc.
+             */
+            return !isOpaque || isShaped() || isTextured();
         }
     }
 
     @Override
     final void applyShapeImpl(final Region shape) {

@@ -611,15 +627,17 @@
                 }
                 if (isTranslucent()) {
                     g.setColor(nonOpaqueBackground);
                     g.fillRect(0, 0, w, h);
                 }
+                if (!isTextured()) {
                 if (g instanceof SunGraphics2D) {
                     SG2DConstraint((SunGraphics2D) g, getRegion());
                 }
                 g.setColor(getBackground());
                 g.fillRect(0, 0, w, h);
+                }
             } finally {
                 g.dispose();
             }
         }
     }

@@ -980,12 +998,14 @@
                     g.setColor(nonOpaqueBackground);
                     g.fillRect(0, 0, r.width, r.height);
                     if (g instanceof SunGraphics2D) {
                         SG2DConstraint((SunGraphics2D) g, getRegion());
                     }
+                    if (!isTextured()) {
                     g.setColor(getBackground());
                     g.fillRect(0, 0, r.width, r.height);
+                    }
                     if (oldBB != null) {
                         // Draw the old back buffer to the new one
                         g.drawImage(oldBB, 0, 0, null);
                         oldBB.flush();
                     }