53 import sun.font.FontDesignMetrics; 54 import sun.awt.im.InputContext; 55 import sun.awt.image.*; 56 import sun.net.util.URLUtil; 57 import sun.security.action.GetPropertyAction; 58 import sun.security.action.GetBooleanAction; 59 import java.lang.reflect.InvocationTargetException; 60 import java.security.AccessController; 61 62 public abstract class SunToolkit extends Toolkit 63 implements WindowClosingSupport, WindowClosingListener, 64 ComponentFactory, InputMethodSupport, KeyboardFocusManagerPeerProvider { 65 66 // 8014718: logging has been removed from SunToolkit 67 68 /* Load debug settings for native code */ 69 static { 70 if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.nativedebug"))) { 71 DebugSettings.init(); 72 } 73 }; 74 75 /** 76 * Special mask for the UngrabEvent events, in addition to the 77 * public masks defined in AWTEvent. Should be used as the mask 78 * value for Toolkit.addAWTEventListener. 79 */ 80 public static final int GRAB_EVENT_MASK = 0x80000000; 81 82 /* The key to put()/get() the PostEventQueue into/from the AppContext. 83 */ 84 private static final String POST_EVENT_QUEUE_KEY = "PostEventQueue"; 85 86 /** 87 * Number of buttons. 88 * By default it's taken from the system. If system value does not 89 * fit into int type range, use our own MAX_BUTTONS_SUPPORT value. 90 */ 91 protected static int numberOfButtons = 0; 92 1690 1691 /** 1692 * Grabs the mouse input for the given window. The window must be 1693 * visible. The window or its children do not receive any 1694 * additional mouse events besides those targeted to them. All 1695 * other events will be dispatched as before - to the respective 1696 * targets. This Window will receive UngrabEvent when automatic 1697 * ungrab is about to happen. The event can be listened to by 1698 * installing AWTEventListener with WINDOW_EVENT_MASK. See 1699 * UngrabEvent class for the list of conditions when ungrab is 1700 * about to happen. 1701 * @see UngrabEvent 1702 */ 1703 public abstract void grab(Window w); 1704 1705 /** 1706 * Forces ungrab. No event will be sent. 1707 */ 1708 public abstract void ungrab(Window w); 1709 1710 1711 /** 1712 * Locates the splash screen library in a platform dependent way and closes 1713 * the splash screen. Should be invoked on first top-level frame display. 1714 * @see java.awt.SplashScreen 1715 * @since 1.6 1716 */ 1717 public static native void closeSplashScreen(); 1718 1719 /* The following methods and variables are to support retrieving 1720 * desktop text anti-aliasing settings 1721 */ 1722 1723 /* Need an instance method because setDesktopProperty(..) is protected. */ 1724 private void fireDesktopFontPropertyChanges() { 1725 setDesktopProperty(SunToolkit.DESKTOPFONTHINTS, 1726 SunToolkit.getDesktopFontHints()); 1727 } 1728 1729 private static boolean checkedSystemAAFontSettings; | 53 import sun.font.FontDesignMetrics; 54 import sun.awt.im.InputContext; 55 import sun.awt.image.*; 56 import sun.net.util.URLUtil; 57 import sun.security.action.GetPropertyAction; 58 import sun.security.action.GetBooleanAction; 59 import java.lang.reflect.InvocationTargetException; 60 import java.security.AccessController; 61 62 public abstract class SunToolkit extends Toolkit 63 implements WindowClosingSupport, WindowClosingListener, 64 ComponentFactory, InputMethodSupport, KeyboardFocusManagerPeerProvider { 65 66 // 8014718: logging has been removed from SunToolkit 67 68 /* Load debug settings for native code */ 69 static { 70 if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.nativedebug"))) { 71 DebugSettings.init(); 72 } 73 touchKeyboardAutoShowIsEnabled = Boolean.valueOf( 74 AccessController.doPrivileged(new GetPropertyAction( 75 "awt.touchKeyboardAutoShowIsEnabled", "true"))); 76 }; 77 78 /** 79 * Special mask for the UngrabEvent events, in addition to the 80 * public masks defined in AWTEvent. Should be used as the mask 81 * value for Toolkit.addAWTEventListener. 82 */ 83 public static final int GRAB_EVENT_MASK = 0x80000000; 84 85 /* The key to put()/get() the PostEventQueue into/from the AppContext. 86 */ 87 private static final String POST_EVENT_QUEUE_KEY = "PostEventQueue"; 88 89 /** 90 * Number of buttons. 91 * By default it's taken from the system. If system value does not 92 * fit into int type range, use our own MAX_BUTTONS_SUPPORT value. 93 */ 94 protected static int numberOfButtons = 0; 95 1693 1694 /** 1695 * Grabs the mouse input for the given window. The window must be 1696 * visible. The window or its children do not receive any 1697 * additional mouse events besides those targeted to them. All 1698 * other events will be dispatched as before - to the respective 1699 * targets. This Window will receive UngrabEvent when automatic 1700 * ungrab is about to happen. The event can be listened to by 1701 * installing AWTEventListener with WINDOW_EVENT_MASK. See 1702 * UngrabEvent class for the list of conditions when ungrab is 1703 * about to happen. 1704 * @see UngrabEvent 1705 */ 1706 public abstract void grab(Window w); 1707 1708 /** 1709 * Forces ungrab. No event will be sent. 1710 */ 1711 public abstract void ungrab(Window w); 1712 1713 public void showOrHideTouchKeyboard(Component comp, AWTEvent e) {} 1714 1715 private static boolean touchKeyboardAutoShowIsEnabled; 1716 1717 public static boolean isTouchKeyboardAutoShowEnabled() { 1718 return touchKeyboardAutoShowIsEnabled; 1719 } 1720 1721 /** 1722 * Locates the splash screen library in a platform dependent way and closes 1723 * the splash screen. Should be invoked on first top-level frame display. 1724 * @see java.awt.SplashScreen 1725 * @since 1.6 1726 */ 1727 public static native void closeSplashScreen(); 1728 1729 /* The following methods and variables are to support retrieving 1730 * desktop text anti-aliasing settings 1731 */ 1732 1733 /* Need an instance method because setDesktopProperty(..) is protected. */ 1734 private void fireDesktopFontPropertyChanges() { 1735 setDesktopProperty(SunToolkit.DESKTOPFONTHINTS, 1736 SunToolkit.getDesktopFontHints()); 1737 } 1738 1739 private static boolean checkedSystemAAFontSettings; |