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

Print this page

        

@@ -51,11 +51,11 @@
         VIEW_EMBEDDED_FRAME
     }
 
     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWWindowPeer");
 
-    private PlatformWindow platformWindow;
+    private final PlatformWindow platformWindow;
 
     // Window bounds reported by the native system (as opposed to
     // regular bounds inherited from LWComponentPeer which are
     // requested by user and may haven't been applied yet because
     // of asynchronous requests to the windowing system)

@@ -552,27 +552,29 @@
         repaintPeer(r);
     }
 
     /**
      * Called by the {@code PlatformWindow} when this window is moved/resized by
-     * user. There's no notifyReshape() in LWComponentPeer as the only
-     * components which could be resized by user are top-level windows.
+     * user or window insets are changed. There's no notifyReshape() in
+     * LWComponentPeer as the only components which could be resized by user are
+     * top-level windows.
      */
     public final void notifyReshape(int x, int y, int w, int h) {
         final boolean moved;
         final boolean resized;
+        final boolean invalid = updateInsets(platformWindow.getInsets());
         synchronized (getStateLock()) {
             moved = (x != sysX) || (y != sysY);
             resized = (w != sysW) || (h != sysH);
             sysX = x;
             sysY = y;
             sysW = w;
             sysH = h;
         }
 
         // Check if anything changed
-        if (!moved && !resized) {
+        if (!moved && !resized && !invalid) {
             return;
         }
         // First, update peer's bounds
         setBounds(x, y, w, h, SET_BOUNDS, false, false);
 

@@ -582,14 +584,14 @@
             replaceSurfaceData();
             flushOnscreenGraphics();
         }
 
         // Third, COMPONENT_MOVED/COMPONENT_RESIZED/PAINT events
-        if (moved) {
+        if (moved || invalid) {
             handleMove(x, y, true);
         }
-        if (resized) {
+        if (resized || invalid) {
             handleResize(w, h, true);
             repaintPeer();
         }
     }
 

@@ -997,31 +999,25 @@
                           getRegion(), 0, 0, 0, 0, size.width, size.height);
             }
         }
     }
 
-    /*
-     * Request the window insets from the delegate and compares it
-     * with the current one. This method is mostly called by the
-     * delegate, e.g. when the window state is changed and insets
-     * should be recalculated.
-     *
+    /**
+     * Request the window insets from the delegate and compares it with the
+     * current one. This method is mostly called by the delegate, e.g. when the
+     * window state is changed and insets should be recalculated.
+     * <p/>
      * This method may be called on the toolkit thread.
      */
-    public boolean updateInsets(Insets newInsets) {
-        boolean changed = false;
+    public final boolean updateInsets(final Insets newInsets) {
         synchronized (getStateLock()) {
-            changed = (insets.equals(newInsets));
-            insets = newInsets;
+            if (insets.equals(newInsets)) {
+                return false;
         }
-
-        if (changed) {
-            replaceSurfaceData();
-            repaintPeer();
+            insets = newInsets;
         }
-
-        return changed;
+        return true;
     }
 
     public static LWWindowPeer getWindowUnderCursor() {
         return lastCommonMouseEventPeer != null ? lastCommonMouseEventPeer.getWindowPeerOrSelf() : null;
     }