src/share/classes/sun/awt/SunToolkit.java

Print this page




 496         if (!GraphicsEnvironment.isHeadless()) {
 497             if (!setAppContext(target, appContext)) {
 498                 // Target is not a Component/MenuComponent, use the private Map
 499                 // instead.
 500                 appContextMap.put(target, appContext);
 501             }
 502         }
 503     }
 504 
 505     /*
 506      * Post an AWTEvent to the Java EventQueue, using the PostEventQueue
 507      * to avoid possibly calling client code (EventQueueSubclass.postEvent())
 508      * on the toolkit (AWT-Windows/AWT-Motif) thread.  This function should
 509      * not be called under another lock since it locks the EventQueue.
 510      * See bugids 4632918, 4526597.
 511      */
 512     public static void postEvent(AppContext appContext, AWTEvent event) {
 513         if (event == null) {
 514             throw new NullPointerException();
 515         }













 516         // All events posted via this method are system-generated.
 517         // Placing the following call here reduces considerably the
 518         // number of places throughout the toolkit that would
 519         // otherwise have to be modified to precisely identify
 520         // system-generated events.
 521         setSystemGenerated(event);
 522         AppContext eventContext = targetToAppContext(event.getSource());
 523         if (eventContext != null && !eventContext.equals(appContext)) {
 524             log.fine("Event posted on wrong app context : " + event);
 525         }
 526         PostEventQueue postEventQueue =
 527             (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
 528         if (postEventQueue != null) {
 529             postEventQueue.postEvent(event);
 530         }
 531     }
 532 
 533     /*
 534      * Post AWTEvent of high priority.
 535      */


1939     /**
1940      * Returns the value of "sun.awt.disableMixing" property. Default
1941      * value is {@code false}.
1942      */
1943     public synchronized static boolean getSunAwtDisableMixing() {
1944         if (sunAwtDisableMixing == null) {
1945             sunAwtDisableMixing = getBooleanSystemProperty("sun.awt.disableMixing");
1946         }
1947         return sunAwtDisableMixing.booleanValue();
1948     }
1949 
1950     /**
1951      * Returns true if the native GTK libraries are available.  The
1952      * default implementation returns false, but UNIXToolkit overrides this
1953      * method to provide a more specific answer.
1954      */
1955     public boolean isNativeGTKAvailable() {
1956         return false;
1957     }
1958 






















1959     // Cosntant alpha
1960     public boolean isWindowOpacitySupported() {
1961         return false;
1962     }
1963 
1964     // Shaping
1965     public boolean isWindowShapingSupported() {
1966         return false;
1967     }
1968 
1969     // Per-pixel alpha
1970     public boolean isWindowTranslucencySupported() {
1971         return false;
1972     }
1973 
1974     public boolean isTranslucencyCapable(GraphicsConfiguration gc) {
1975         return false;
1976     }
1977 
1978     /**




 496         if (!GraphicsEnvironment.isHeadless()) {
 497             if (!setAppContext(target, appContext)) {
 498                 // Target is not a Component/MenuComponent, use the private Map
 499                 // instead.
 500                 appContextMap.put(target, appContext);
 501             }
 502         }
 503     }
 504 
 505     /*
 506      * Post an AWTEvent to the Java EventQueue, using the PostEventQueue
 507      * to avoid possibly calling client code (EventQueueSubclass.postEvent())
 508      * on the toolkit (AWT-Windows/AWT-Motif) thread.  This function should
 509      * not be called under another lock since it locks the EventQueue.
 510      * See bugids 4632918, 4526597.
 511      */
 512     public static void postEvent(AppContext appContext, AWTEvent event) {
 513         if (event == null) {
 514             throw new NullPointerException();
 515         }
 516         
 517         AWTAccessor.SequencedEventAccessor sea = AWTAccessor.getSequencedEventAccessor();
 518         if (sea != null && sea.isSequencedEvent(event)) {
 519             AWTEvent nested = sea.getNested(event);
 520             if (nested.getID() == WindowEvent.WINDOW_LOST_FOCUS &&
 521                 nested instanceof TimedWindowEvent)
 522             {
 523                 TimedWindowEvent twe = (TimedWindowEvent)nested;
 524                 ((SunToolkit)Toolkit.getDefaultToolkit()).
 525                     setWindowDeactivationTime((Window)twe.getSource(), twe.getWhen());
 526             }
 527         }
 528         
 529         // All events posted via this method are system-generated.
 530         // Placing the following call here reduces considerably the
 531         // number of places throughout the toolkit that would
 532         // otherwise have to be modified to precisely identify
 533         // system-generated events.
 534         setSystemGenerated(event);
 535         AppContext eventContext = targetToAppContext(event.getSource());
 536         if (eventContext != null && !eventContext.equals(appContext)) {
 537             log.fine("Event posted on wrong app context : " + event);
 538         }
 539         PostEventQueue postEventQueue =
 540             (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
 541         if (postEventQueue != null) {
 542             postEventQueue.postEvent(event);
 543         }
 544     }
 545 
 546     /*
 547      * Post AWTEvent of high priority.
 548      */


1952     /**
1953      * Returns the value of "sun.awt.disableMixing" property. Default
1954      * value is {@code false}.
1955      */
1956     public synchronized static boolean getSunAwtDisableMixing() {
1957         if (sunAwtDisableMixing == null) {
1958             sunAwtDisableMixing = getBooleanSystemProperty("sun.awt.disableMixing");
1959         }
1960         return sunAwtDisableMixing.booleanValue();
1961     }
1962 
1963     /**
1964      * Returns true if the native GTK libraries are available.  The
1965      * default implementation returns false, but UNIXToolkit overrides this
1966      * method to provide a more specific answer.
1967      */
1968     public boolean isNativeGTKAvailable() {
1969         return false;
1970     }
1971 
1972     private static final Object DEACTIVATION_TIMES_MAP_KEY = new Object();
1973 
1974     public synchronized void setWindowDeactivationTime(Window w, long time) {
1975         AppContext ctx = getAppContext(w);
1976         WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
1977         if (map == null) {
1978             map = new WeakHashMap<Window, Long>();
1979             ctx.put(DEACTIVATION_TIMES_MAP_KEY, map);
1980         }
1981         map.put(w, time);
1982     }
1983 
1984     public synchronized long getWindowDeactivationTime(Window w) {
1985         AppContext ctx = getAppContext(w);
1986         WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
1987         if (map == null) {
1988             return -1;
1989         }
1990         Long time = map.get(w);
1991         return time == null ? -1 : time;
1992     }
1993 
1994     // Cosntant alpha
1995     public boolean isWindowOpacitySupported() {
1996         return false;
1997     }
1998 
1999     // Shaping
2000     public boolean isWindowShapingSupported() {
2001         return false;
2002     }
2003 
2004     // Per-pixel alpha
2005     public boolean isWindowTranslucencySupported() {
2006         return false;
2007     }
2008 
2009     public boolean isTranslucencyCapable(GraphicsConfiguration gc) {
2010         return false;
2011     }
2012 
2013     /**