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

Print this page




  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.lwawt.macosx;
  27 
  28 import java.awt.*;
  29 import java.awt.Dialog.ModalityType;
  30 import java.awt.event.*;
  31 import java.awt.peer.WindowPeer;
  32 import java.beans.*;
  33 import java.lang.reflect.InvocationTargetException;
  34 import java.util.List;

  35 
  36 import javax.swing.*;
  37 
  38 import sun.awt.*;
  39 import sun.java2d.SurfaceData;
  40 import sun.java2d.opengl.CGLSurfaceData;
  41 import sun.lwawt.*;
  42 import sun.util.logging.PlatformLogger;
  43 
  44 import com.apple.laf.*;
  45 import com.apple.laf.ClientPropertyApplicator.Property;
  46 import com.sun.awt.AWTUtilities;
  47 
  48 public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
  49     private native long nativeCreateNSWindow(long nsViewPtr, long styleBits, double x, double y, double w, double h);
  50     private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
  51     private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
  52     private static native Insets nativeGetNSWindowInsets(long nsWindowPtr);
  53     private static native void nativeSetNSWindowBounds(long nsWindowPtr, double x, double y, double w, double h);
  54     private static native void nativeSetNSWindowMinMax(long nsWindowPtr, double minW, double minH, double maxW, double maxH);


 899             focusLogger.fine("the app is inactive, so the notification is ignored");
 900             return;
 901         }
 902 
 903         LWWindowPeer oppositePeer = (opposite == null)? null : opposite.getPeer();
 904         responder.handleWindowFocusEvent(gained, oppositePeer);
 905     }
 906 
 907     private void deliverMoveResizeEvent(int x, int y, int width, int height,
 908                                         boolean byUser) {
 909         // when the content view enters the full-screen mode, the native
 910         // move/resize notifications contain a bounds smaller than
 911         // the whole screen and therefore we ignore the native notifications
 912         // and the content view itself creates correct synthetic notifications
 913         if (isFullScreenMode) {
 914             return;
 915         }
 916 
 917         final Rectangle oldB = nativeBounds;
 918         nativeBounds = new Rectangle(x, y, width, height);

 919         peer.notifyReshape(x, y, width, height);


 920         if ((byUser && !oldB.getSize().equals(nativeBounds.getSize()))
 921             || isFullScreenAnimationOn) {
 922             flushBuffers();
 923         }
 924     }
 925 
 926     private void deliverWindowClosingEvent() {
 927         if (peer.getBlocker() == null)  {
 928             peer.postEvent(new WindowEvent(target, WindowEvent.WINDOW_CLOSING));
 929         }
 930     }
 931 
 932     private void deliverIconify(final boolean iconify) {
 933         peer.notifyIconify(iconify);
 934     }
 935 
 936     private void deliverZoom(final boolean isZoomed) {
 937         peer.notifyZoom(isZoomed);
 938     }
 939 
 940     private void deliverNCMouseDown() {
 941         peer.notifyNCMouseDown();




  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.lwawt.macosx;
  27 
  28 import java.awt.*;
  29 import java.awt.Dialog.ModalityType;
  30 import java.awt.event.*;
  31 import java.awt.peer.WindowPeer;
  32 import java.beans.*;
  33 import java.lang.reflect.InvocationTargetException;
  34 import java.util.List;
  35 import java.util.Objects;
  36 
  37 import javax.swing.*;
  38 
  39 import sun.awt.*;
  40 import sun.java2d.SurfaceData;
  41 import sun.java2d.opengl.CGLSurfaceData;
  42 import sun.lwawt.*;
  43 import sun.util.logging.PlatformLogger;
  44 
  45 import com.apple.laf.*;
  46 import com.apple.laf.ClientPropertyApplicator.Property;
  47 import com.sun.awt.AWTUtilities;
  48 
  49 public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
  50     private native long nativeCreateNSWindow(long nsViewPtr, long styleBits, double x, double y, double w, double h);
  51     private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
  52     private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
  53     private static native Insets nativeGetNSWindowInsets(long nsWindowPtr);
  54     private static native void nativeSetNSWindowBounds(long nsWindowPtr, double x, double y, double w, double h);
  55     private static native void nativeSetNSWindowMinMax(long nsWindowPtr, double minW, double minH, double maxW, double maxH);


 900             focusLogger.fine("the app is inactive, so the notification is ignored");
 901             return;
 902         }
 903 
 904         LWWindowPeer oppositePeer = (opposite == null)? null : opposite.getPeer();
 905         responder.handleWindowFocusEvent(gained, oppositePeer);
 906     }
 907 
 908     private void deliverMoveResizeEvent(int x, int y, int width, int height,
 909                                         boolean byUser) {
 910         // when the content view enters the full-screen mode, the native
 911         // move/resize notifications contain a bounds smaller than
 912         // the whole screen and therefore we ignore the native notifications
 913         // and the content view itself creates correct synthetic notifications
 914         if (isFullScreenMode) {
 915             return;
 916         }
 917 
 918         final Rectangle oldB = nativeBounds;
 919         nativeBounds = new Rectangle(x, y, width, height);
 920         final GraphicsConfiguration oldGC = peer.getGraphicsConfiguration();
 921         peer.notifyReshape(x, y, width, height);
 922         final GraphicsConfiguration newGC = peer.getGraphicsConfiguration();
 923         // System-dependent appearance optimization.
 924         if ((byUser && !oldB.getSize().equals(nativeBounds.getSize()))
 925             || isFullScreenAnimationOn || !Objects.equals(newGC, oldGC)) {
 926             flushBuffers();
 927         }
 928     }
 929 
 930     private void deliverWindowClosingEvent() {
 931         if (peer.getBlocker() == null)  {
 932             peer.postEvent(new WindowEvent(target, WindowEvent.WINDOW_CLOSING));
 933         }
 934     }
 935 
 936     private void deliverIconify(final boolean iconify) {
 937         peer.notifyIconify(iconify);
 938     }
 939 
 940     private void deliverZoom(final boolean isZoomed) {
 941         peer.notifyZoom(isZoomed);
 942     }
 943 
 944     private void deliverNCMouseDown() {
 945         peer.notifyNCMouseDown();