67 import sun.awt.image.ToolkitImage; 68 import sun.awt.image.URLImageSource; 69 import sun.font.FontDesignMetrics; 70 import sun.net.util.URLUtil; 71 import sun.security.action.GetBooleanAction; 72 import sun.security.action.GetPropertyAction; 73 import sun.util.logging.PlatformLogger; 74 75 import static java.awt.RenderingHints.*; 76 77 public abstract class SunToolkit extends Toolkit 78 implements ComponentFactory, InputMethodSupport, KeyboardFocusManagerPeerProvider { 79 80 // 8014718: logging has been removed from SunToolkit 81 82 /* Load debug settings for native code */ 83 static { 84 if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.nativedebug"))) { 85 DebugSettings.init(); 86 } 87 }; 88 89 /** 90 * Special mask for the UngrabEvent events, in addition to the 91 * public masks defined in AWTEvent. Should be used as the mask 92 * value for Toolkit.addAWTEventListener. 93 */ 94 public static final int GRAB_EVENT_MASK = 0x80000000; 95 96 /* The key to put()/get() the PostEventQueue into/from the AppContext. 97 */ 98 private static final String POST_EVENT_QUEUE_KEY = "PostEventQueue"; 99 100 /** 101 * Number of buttons. 102 * By default it's taken from the system. If system value does not 103 * fit into int type range, use our own MAX_BUTTONS_SUPPORT value. 104 */ 105 protected static int numberOfButtons = 0; 106 1597 1598 /** 1599 * Grabs the mouse input for the given window. The window must be 1600 * visible. The window or its children do not receive any 1601 * additional mouse events besides those targeted to them. All 1602 * other events will be dispatched as before - to the respective 1603 * targets. This Window will receive UngrabEvent when automatic 1604 * ungrab is about to happen. The event can be listened to by 1605 * installing AWTEventListener with WINDOW_EVENT_MASK. See 1606 * UngrabEvent class for the list of conditions when ungrab is 1607 * about to happen. 1608 * @see UngrabEvent 1609 */ 1610 public abstract void grab(Window w); 1611 1612 /** 1613 * Forces ungrab. No event will be sent. 1614 */ 1615 public abstract void ungrab(Window w); 1616 1617 1618 /** 1619 * Locates the splash screen library in a platform dependent way and closes 1620 * the splash screen. Should be invoked on first top-level frame display. 1621 * @see java.awt.SplashScreen 1622 * @since 1.6 1623 */ 1624 public static native void closeSplashScreen(); 1625 1626 /* The following methods and variables are to support retrieving 1627 * desktop text anti-aliasing settings 1628 */ 1629 1630 /* Need an instance method because setDesktopProperty(..) is protected. */ 1631 private void fireDesktopFontPropertyChanges() { 1632 setDesktopProperty(SunToolkit.DESKTOPFONTHINTS, 1633 SunToolkit.getDesktopFontHints()); 1634 } 1635 1636 private static boolean checkedSystemAAFontSettings; | 67 import sun.awt.image.ToolkitImage; 68 import sun.awt.image.URLImageSource; 69 import sun.font.FontDesignMetrics; 70 import sun.net.util.URLUtil; 71 import sun.security.action.GetBooleanAction; 72 import sun.security.action.GetPropertyAction; 73 import sun.util.logging.PlatformLogger; 74 75 import static java.awt.RenderingHints.*; 76 77 public abstract class SunToolkit extends Toolkit 78 implements ComponentFactory, InputMethodSupport, KeyboardFocusManagerPeerProvider { 79 80 // 8014718: logging has been removed from SunToolkit 81 82 /* Load debug settings for native code */ 83 static { 84 if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.nativedebug"))) { 85 DebugSettings.init(); 86 } 87 touchKeyboardAutoShowIsEnabled = Boolean.valueOf( 88 GetPropertyAction.privilegedGetProperty( 89 "awt.touchKeyboardAutoShowIsEnabled", "false")); 90 }; 91 92 /** 93 * Special mask for the UngrabEvent events, in addition to the 94 * public masks defined in AWTEvent. Should be used as the mask 95 * value for Toolkit.addAWTEventListener. 96 */ 97 public static final int GRAB_EVENT_MASK = 0x80000000; 98 99 /* The key to put()/get() the PostEventQueue into/from the AppContext. 100 */ 101 private static final String POST_EVENT_QUEUE_KEY = "PostEventQueue"; 102 103 /** 104 * Number of buttons. 105 * By default it's taken from the system. If system value does not 106 * fit into int type range, use our own MAX_BUTTONS_SUPPORT value. 107 */ 108 protected static int numberOfButtons = 0; 109 1600 1601 /** 1602 * Grabs the mouse input for the given window. The window must be 1603 * visible. The window or its children do not receive any 1604 * additional mouse events besides those targeted to them. All 1605 * other events will be dispatched as before - to the respective 1606 * targets. This Window will receive UngrabEvent when automatic 1607 * ungrab is about to happen. The event can be listened to by 1608 * installing AWTEventListener with WINDOW_EVENT_MASK. See 1609 * UngrabEvent class for the list of conditions when ungrab is 1610 * about to happen. 1611 * @see UngrabEvent 1612 */ 1613 public abstract void grab(Window w); 1614 1615 /** 1616 * Forces ungrab. No event will be sent. 1617 */ 1618 public abstract void ungrab(Window w); 1619 1620 public void showOrHideTouchKeyboard(Component comp, AWTEvent e) {} 1621 1622 private static boolean touchKeyboardAutoShowIsEnabled; 1623 1624 public static boolean isTouchKeyboardAutoShowEnabled() { 1625 return touchKeyboardAutoShowIsEnabled; 1626 } 1627 1628 /** 1629 * Locates the splash screen library in a platform dependent way and closes 1630 * the splash screen. Should be invoked on first top-level frame display. 1631 * @see java.awt.SplashScreen 1632 * @since 1.6 1633 */ 1634 public static native void closeSplashScreen(); 1635 1636 /* The following methods and variables are to support retrieving 1637 * desktop text anti-aliasing settings 1638 */ 1639 1640 /* Need an instance method because setDesktopProperty(..) is protected. */ 1641 private void fireDesktopFontPropertyChanges() { 1642 setDesktopProperty(SunToolkit.DESKTOPFONTHINTS, 1643 SunToolkit.getDesktopFontHints()); 1644 } 1645 1646 private static boolean checkedSystemAAFontSettings; |