< prev index next >

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

Print this page
rev 58521 : 7185258: [macosx] Deadlock in SunToolKit.realSync()
Reviewed-by: XXX


  90 import java.security.AccessController;
  91 import java.security.PrivilegedAction;
  92 import java.util.HashMap;
  93 import java.util.Locale;
  94 import java.util.Map;
  95 import java.util.MissingResourceException;
  96 import java.util.Objects;
  97 import java.util.ResourceBundle;
  98 import java.util.concurrent.Callable;
  99 
 100 import javax.swing.UIManager;
 101 
 102 import com.apple.laf.AquaMenuBarUI;
 103 import sun.awt.AWTAccessor;
 104 import sun.awt.AppContext;
 105 import sun.awt.CGraphicsDevice;
 106 import sun.awt.LightweightFrame;
 107 import sun.awt.PlatformGraphicsInfo;
 108 import sun.awt.SunToolkit;
 109 import sun.awt.datatransfer.DataTransferer;

 110 import sun.awt.util.ThreadGroupUtils;
 111 import sun.java2d.opengl.OGLRenderQueue;
 112 import sun.lwawt.LWComponentPeer;
 113 import sun.lwawt.LWCursorManager;
 114 import sun.lwawt.LWToolkit;
 115 import sun.lwawt.LWWindowPeer;
 116 import sun.lwawt.LWWindowPeer.PeerType;
 117 import sun.lwawt.PlatformComponent;
 118 import sun.lwawt.PlatformDropTarget;
 119 import sun.lwawt.PlatformWindow;
 120 import sun.lwawt.SecurityWarningWindow;
 121 
 122 @SuppressWarnings("serial") // JDK implementation class
 123 final class NamedCursor extends Cursor {
 124     NamedCursor(String name) {
 125         super(name);
 126     }
 127 }
 128 
 129 /**


 446 
 447         // These DnD properties must be set, otherwise Swing ends up spewing NPEs
 448         // all over the place. The values came straight off of MToolkit.
 449         desktopProperties.put("DnD.Autoscroll.initialDelay", Integer.valueOf(50));
 450         desktopProperties.put("DnD.Autoscroll.interval", Integer.valueOf(50));
 451         desktopProperties.put("DnD.Autoscroll.cursorHysteresis", Integer.valueOf(5));
 452 
 453         desktopProperties.put("DnD.isDragImageSupported", Boolean.TRUE);
 454 
 455         // Register DnD cursors
 456         desktopProperties.put("DnD.Cursor.CopyDrop", new NamedCursor("DnD.Cursor.CopyDrop"));
 457         desktopProperties.put("DnD.Cursor.MoveDrop", new NamedCursor("DnD.Cursor.MoveDrop"));
 458         desktopProperties.put("DnD.Cursor.LinkDrop", new NamedCursor("DnD.Cursor.LinkDrop"));
 459         desktopProperties.put("DnD.Cursor.CopyNoDrop", new NamedCursor("DnD.Cursor.CopyNoDrop"));
 460         desktopProperties.put("DnD.Cursor.MoveNoDrop", new NamedCursor("DnD.Cursor.MoveNoDrop"));
 461         desktopProperties.put("DnD.Cursor.LinkNoDrop", new NamedCursor("DnD.Cursor.LinkNoDrop"));
 462     }
 463 
 464     @Override
 465     protected boolean syncNativeQueue(long timeout) {





 466         return nativeSyncQueue(timeout);
 467     }
 468 
 469     @Override
 470     public native void beep();
 471 
 472     @Override
 473     public int getScreenResolution() throws HeadlessException {
 474         return (int) ((CGraphicsDevice) GraphicsEnvironment
 475                 .getLocalGraphicsEnvironment().getDefaultScreenDevice())
 476                 .getXResolution();
 477     }
 478 
 479     @Override
 480     public Insets getScreenInsets(final GraphicsConfiguration gc) {
 481         GraphicsDevice gd = gc.getDevice();
 482         if (!(gd instanceof CGraphicsDevice)) {
 483             return super.getScreenInsets(gc);
 484         }
 485         return ((CGraphicsDevice)gd).getScreenInsets();




  90 import java.security.AccessController;
  91 import java.security.PrivilegedAction;
  92 import java.util.HashMap;
  93 import java.util.Locale;
  94 import java.util.Map;
  95 import java.util.MissingResourceException;
  96 import java.util.Objects;
  97 import java.util.ResourceBundle;
  98 import java.util.concurrent.Callable;
  99 
 100 import javax.swing.UIManager;
 101 
 102 import com.apple.laf.AquaMenuBarUI;
 103 import sun.awt.AWTAccessor;
 104 import sun.awt.AppContext;
 105 import sun.awt.CGraphicsDevice;
 106 import sun.awt.LightweightFrame;
 107 import sun.awt.PlatformGraphicsInfo;
 108 import sun.awt.SunToolkit;
 109 import sun.awt.datatransfer.DataTransferer;
 110 import sun.awt.dnd.SunDragSourceContextPeer;
 111 import sun.awt.util.ThreadGroupUtils;
 112 import sun.java2d.opengl.OGLRenderQueue;
 113 import sun.lwawt.LWComponentPeer;
 114 import sun.lwawt.LWCursorManager;
 115 import sun.lwawt.LWToolkit;
 116 import sun.lwawt.LWWindowPeer;
 117 import sun.lwawt.LWWindowPeer.PeerType;
 118 import sun.lwawt.PlatformComponent;
 119 import sun.lwawt.PlatformDropTarget;
 120 import sun.lwawt.PlatformWindow;
 121 import sun.lwawt.SecurityWarningWindow;
 122 
 123 @SuppressWarnings("serial") // JDK implementation class
 124 final class NamedCursor extends Cursor {
 125     NamedCursor(String name) {
 126         super(name);
 127     }
 128 }
 129 
 130 /**


 447 
 448         // These DnD properties must be set, otherwise Swing ends up spewing NPEs
 449         // all over the place. The values came straight off of MToolkit.
 450         desktopProperties.put("DnD.Autoscroll.initialDelay", Integer.valueOf(50));
 451         desktopProperties.put("DnD.Autoscroll.interval", Integer.valueOf(50));
 452         desktopProperties.put("DnD.Autoscroll.cursorHysteresis", Integer.valueOf(5));
 453 
 454         desktopProperties.put("DnD.isDragImageSupported", Boolean.TRUE);
 455 
 456         // Register DnD cursors
 457         desktopProperties.put("DnD.Cursor.CopyDrop", new NamedCursor("DnD.Cursor.CopyDrop"));
 458         desktopProperties.put("DnD.Cursor.MoveDrop", new NamedCursor("DnD.Cursor.MoveDrop"));
 459         desktopProperties.put("DnD.Cursor.LinkDrop", new NamedCursor("DnD.Cursor.LinkDrop"));
 460         desktopProperties.put("DnD.Cursor.CopyNoDrop", new NamedCursor("DnD.Cursor.CopyNoDrop"));
 461         desktopProperties.put("DnD.Cursor.MoveNoDrop", new NamedCursor("DnD.Cursor.MoveNoDrop"));
 462         desktopProperties.put("DnD.Cursor.LinkNoDrop", new NamedCursor("DnD.Cursor.LinkNoDrop"));
 463     }
 464 
 465     @Override
 466     protected boolean syncNativeQueue(long timeout) {
 467         if (SunDragSourceContextPeer.isDragDropInProgress()) {
 468             // The java code started the DnD, but the native drag may still not
 469             // start, the last attempt to flush the native events
 470             timeout = 50;
 471         }
 472         return nativeSyncQueue(timeout);
 473     }
 474 
 475     @Override
 476     public native void beep();
 477 
 478     @Override
 479     public int getScreenResolution() throws HeadlessException {
 480         return (int) ((CGraphicsDevice) GraphicsEnvironment
 481                 .getLocalGraphicsEnvironment().getDefaultScreenDevice())
 482                 .getXResolution();
 483     }
 484 
 485     @Override
 486     public Insets getScreenInsets(final GraphicsConfiguration gc) {
 487         GraphicsDevice gd = gc.getDevice();
 488         if (!(gd instanceof CGraphicsDevice)) {
 489             return super.getScreenInsets(gc);
 490         }
 491         return ((CGraphicsDevice)gd).getScreenInsets();


< prev index next >