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

Print this page

        

@@ -44,11 +44,11 @@
 
 import com.apple.laf.*;
 import com.apple.laf.ClientPropertyApplicator.Property;
 import com.sun.awt.AWTUtilities;
 
-public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
+public final class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
     private native long nativeCreateNSWindow(long nsViewPtr, long styleBits, double x, double y, double w, double h);
     private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
     private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
     private static native Insets nativeGetNSWindowInsets(long nsWindowPtr);
     private static native void nativeSetNSWindowBounds(long nsWindowPtr, double x, double y, double w, double h);

@@ -197,11 +197,11 @@
 
     // Bounds of the native widget but in the Java coordinate system.
     // In order to keep it up-to-date we will update them on
     // 1) setting native bounds via nativeSetBounds() call
     // 2) getting notification from the native level via deliverMoveResizeEvent()
-    private Rectangle nativeBounds;
+    private Rectangle nativeBounds = new Rectangle(0, 0, 0, 0);
     private volatile boolean isFullScreenMode = false;
 
     private Window target;
     private LWWindowPeer peer;
     private CPlatformView contentView;

@@ -867,10 +867,16 @@
         if (surfaceData instanceof CGLSurfaceData) {
             ((CGLSurfaceData)surfaceData).validate();
         }
     }
 
+    private void flushBuffers() {
+        if (isVisible() && !nativeBounds.isEmpty()) {
+            LWCToolkit.getLWCToolkit().flushPendingEventsOnAppkit(target);
+        }
+    }
+
     /*************************************************************
      * Callbacks from the AWTWindow and AWTView objc classes.
      *************************************************************/
     private void deliverWindowFocusEvent(boolean gained){
         // Fix for 7150349: ingore "gained" notifications when the app is inactive.

@@ -884,14 +890,20 @@
     private void deliverMoveResizeEvent(int x, int y, int width, int height) {
         // when the content view enters the full-screen mode, the native
         // move/resize notifications contain a bounds smaller than
         // the whole screen and therefore we ignore the native notifications
         // and the content view itself creates correct synthetic notifications
-        if (isFullScreenMode) return;
+        if (isFullScreenMode) {
+            return;
+        }
 
+        final Rectangle oldB = nativeBounds;
         nativeBounds = new Rectangle(x, y, width, height);
         peer.notifyReshape(x, y, width, height);
+        if (!oldB.getSize().equals(nativeBounds.getSize()) ) {
+            flushBuffers();
+        }
         //TODO validateSurface already called from notifyReshape
         validateSurface();
     }
 
     private void deliverWindowClosingEvent() {