< prev index next >

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

Print this page




  34 
  35 import javax.swing.*;
  36 
  37 import sun.awt.*;
  38 import sun.awt.AWTAccessor.ComponentAccessor;
  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 ownerPtr, 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 nativeSetNSWindowStandardFrame(long nsWindowPtr,
  55             double x, double y, double w, double h);
  56     private static native void nativeSetNSWindowMinMax(long nsWindowPtr, double minW, double minH, double maxW, double maxH);
  57     private static native void nativePushNSWindowToBack(long nsWindowPtr);
  58     private static native void nativePushNSWindowToFront(long nsWindowPtr);
  59     private static native void nativeSetNSWindowTitle(long nsWindowPtr, String title);
  60     private static native void nativeRevalidateNSWindowShadow(long nsWindowPtr);
  61     private static native void nativeSetNSWindowMinimizedIcon(long nsWindowPtr, long nsImage);
  62     private static native void nativeSetNSWindowRepresentedFilename(long nsWindowPtr, String representedFilename);
  63     private static native void nativeSetEnabled(long nsWindowPtr, boolean isEnabled);
  64     private static native void nativeSynthesizeMouseEnteredExitedEvents();
  65     private static native void nativeDispose(long nsWindowPtr);
  66     private static native void nativeEnterFullScreenMode(long nsWindowPtr);
  67     private static native void nativeExitFullScreenMode(long nsWindowPtr);
  68     static native CPlatformWindow nativeGetTopmostPlatformWindowUnderMouse();
  69 
  70     // Loger to report issues happened during execution but that do not affect functionality
  71     private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow");
  72     private static final PlatformLogger focusLogger = PlatformLogger.getLogger("sun.lwawt.macosx.focus.CPlatformWindow");
  73 


 513             Rectangle toBounds = this.normalBounds;
 514             this.normalBounds = null;
 515             setBounds(toBounds.x, toBounds.y, toBounds.width, toBounds.height);
 516         }
 517     }
 518 
 519     public boolean isVisible() {
 520         return this.visible;
 521     }
 522 
 523     @Override // PlatformWindow
 524     public void setVisible(boolean visible) {
 525         final long nsWindowPtr = getNSWindowPtr();
 526 
 527         // Configure stuff
 528         updateIconImages();
 529         updateFocusabilityForAutoRequestFocus(false);
 530 
 531         boolean wasMaximized = isMaximized();
 532 




 533         // Actually show or hide the window
 534         LWWindowPeer blocker = (peer == null)? null : peer.getBlocker();
 535         if (blocker == null || !visible) {
 536             // If it ain't blocked, or is being hidden, go regular way
 537             if (visible) {
 538                 CWrapper.NSWindow.makeFirstResponder(nsWindowPtr, contentView.getAWTView());
 539 
 540                 boolean isPopup = (target.getType() == Window.Type.POPUP);
 541                 if (isPopup) {
 542                     // Popups in applets don't activate applet's process
 543                     CWrapper.NSWindow.orderFrontRegardless(nsWindowPtr);
 544                 } else {
 545                     CWrapper.NSWindow.orderFront(nsWindowPtr);
 546                 }
 547 
 548                 boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(nsWindowPtr);
 549                 if (!isKeyWindow) {
 550                     CWrapper.NSWindow.makeKeyWindow(nsWindowPtr);
 551                 }
 552             } else {




  34 
  35 import javax.swing.*;
  36 
  37 import sun.awt.*;
  38 import sun.awt.AWTAccessor.ComponentAccessor;
  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 ownerPtr, 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 nativeSetNSWindowLocationByPlatform(long nsWindowPtr);
  55     private static native void nativeSetNSWindowStandardFrame(long nsWindowPtr,
  56             double x, double y, double w, double h);
  57     private static native void nativeSetNSWindowMinMax(long nsWindowPtr, double minW, double minH, double maxW, double maxH);
  58     private static native void nativePushNSWindowToBack(long nsWindowPtr);
  59     private static native void nativePushNSWindowToFront(long nsWindowPtr);
  60     private static native void nativeSetNSWindowTitle(long nsWindowPtr, String title);
  61     private static native void nativeRevalidateNSWindowShadow(long nsWindowPtr);
  62     private static native void nativeSetNSWindowMinimizedIcon(long nsWindowPtr, long nsImage);
  63     private static native void nativeSetNSWindowRepresentedFilename(long nsWindowPtr, String representedFilename);
  64     private static native void nativeSetEnabled(long nsWindowPtr, boolean isEnabled);
  65     private static native void nativeSynthesizeMouseEnteredExitedEvents();
  66     private static native void nativeDispose(long nsWindowPtr);
  67     private static native void nativeEnterFullScreenMode(long nsWindowPtr);
  68     private static native void nativeExitFullScreenMode(long nsWindowPtr);
  69     static native CPlatformWindow nativeGetTopmostPlatformWindowUnderMouse();
  70 
  71     // Loger to report issues happened during execution but that do not affect functionality
  72     private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow");
  73     private static final PlatformLogger focusLogger = PlatformLogger.getLogger("sun.lwawt.macosx.focus.CPlatformWindow");
  74 


 514             Rectangle toBounds = this.normalBounds;
 515             this.normalBounds = null;
 516             setBounds(toBounds.x, toBounds.y, toBounds.width, toBounds.height);
 517         }
 518     }
 519 
 520     public boolean isVisible() {
 521         return this.visible;
 522     }
 523 
 524     @Override // PlatformWindow
 525     public void setVisible(boolean visible) {
 526         final long nsWindowPtr = getNSWindowPtr();
 527 
 528         // Configure stuff
 529         updateIconImages();
 530         updateFocusabilityForAutoRequestFocus(false);
 531 
 532         boolean wasMaximized = isMaximized();
 533 
 534         if (visible && target.isLocationByPlatform()) {
 535             nativeSetNSWindowLocationByPlatform(getNSWindowPtr());
 536         }
 537         
 538         // Actually show or hide the window
 539         LWWindowPeer blocker = (peer == null)? null : peer.getBlocker();
 540         if (blocker == null || !visible) {
 541             // If it ain't blocked, or is being hidden, go regular way
 542             if (visible) {
 543                 CWrapper.NSWindow.makeFirstResponder(nsWindowPtr, contentView.getAWTView());
 544 
 545                 boolean isPopup = (target.getType() == Window.Type.POPUP);
 546                 if (isPopup) {
 547                     // Popups in applets don't activate applet's process
 548                     CWrapper.NSWindow.orderFrontRegardless(nsWindowPtr);
 549                 } else {
 550                     CWrapper.NSWindow.orderFront(nsWindowPtr);
 551                 }
 552 
 553                 boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(nsWindowPtr);
 554                 if (!isKeyWindow) {
 555                     CWrapper.NSWindow.makeKeyWindow(nsWindowPtr);
 556                 }
 557             } else {


< prev index next >