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

Print this page




 531         if (!GraphicsEnvironment.isHeadless()) {
 532             if (!setAppContext(target, appContext)) {
 533                 // Target is not a Component/MenuComponent, use the private Map
 534                 // instead.
 535                 appContextMap.put(target, appContext);
 536             }
 537         }
 538     }
 539 
 540     /*
 541      * Post an AWTEvent to the Java EventQueue, using the PostEventQueue
 542      * to avoid possibly calling client code (EventQueueSubclass.postEvent())
 543      * on the toolkit (AWT-Windows/AWT-Motif) thread.  This function should
 544      * not be called under another lock since it locks the EventQueue.
 545      * See bugids 4632918, 4526597.
 546      */
 547     public static void postEvent(AppContext appContext, AWTEvent event) {
 548         if (event == null) {
 549             throw new NullPointerException();
 550         }













 551         // All events posted via this method are system-generated.
 552         // Placing the following call here reduces considerably the
 553         // number of places throughout the toolkit that would
 554         // otherwise have to be modified to precisely identify
 555         // system-generated events.
 556         setSystemGenerated(event);
 557         AppContext eventContext = targetToAppContext(event.getSource());
 558         if (eventContext != null && !eventContext.equals(appContext)) {
 559             log.fine("Event posted on wrong app context : " + event);
 560         }
 561         PostEventQueue postEventQueue =
 562             (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
 563         if (postEventQueue != null) {
 564             postEventQueue.postEvent(event);
 565         }
 566     }
 567 
 568     /*
 569      * Post AWTEvent of high priority.
 570      */


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











1964     // Cosntant alpha
1965     public boolean isWindowOpacitySupported() {
1966         return false;
1967     }
1968 
1969     // Shaping
1970     public boolean isWindowShapingSupported() {
1971         return false;
1972     }
1973 
1974     // Per-pixel alpha
1975     public boolean isWindowTranslucencySupported() {
1976         return false;
1977     }
1978 
1979     public boolean isTranslucencyCapable(GraphicsConfiguration gc) {
1980         return false;
1981     }
1982 
1983     /**




 531         if (!GraphicsEnvironment.isHeadless()) {
 532             if (!setAppContext(target, appContext)) {
 533                 // Target is not a Component/MenuComponent, use the private Map
 534                 // instead.
 535                 appContextMap.put(target, appContext);
 536             }
 537         }
 538     }
 539 
 540     /*
 541      * Post an AWTEvent to the Java EventQueue, using the PostEventQueue
 542      * to avoid possibly calling client code (EventQueueSubclass.postEvent())
 543      * on the toolkit (AWT-Windows/AWT-Motif) thread.  This function should
 544      * not be called under another lock since it locks the EventQueue.
 545      * See bugids 4632918, 4526597.
 546      */
 547     public static void postEvent(AppContext appContext, AWTEvent event) {
 548         if (event == null) {
 549             throw new NullPointerException();
 550         }
 551         
 552         AWTAccessor.SequencedEventAccessor sea = AWTAccessor.getSequencedEventAccessor();
 553         if (sea != null && sea.isSequencedEvent(event)) {
 554             AWTEvent nested = sea.getNested(event);
 555             if (nested.getID() == WindowEvent.WINDOW_LOST_FOCUS &&
 556                 nested instanceof TimedWindowEvent)
 557             {
 558                 TimedWindowEvent twe = (TimedWindowEvent)nested;
 559                 ((SunToolkit)Toolkit.getDefaultToolkit()).
 560                     setDeactivationTime((Window)twe.getSource(), twe.getWhen());
 561             }
 562         }
 563         
 564         // All events posted via this method are system-generated.
 565         // Placing the following call here reduces considerably the
 566         // number of places throughout the toolkit that would
 567         // otherwise have to be modified to precisely identify
 568         // system-generated events.
 569         setSystemGenerated(event);
 570         AppContext eventContext = targetToAppContext(event.getSource());
 571         if (eventContext != null && !eventContext.equals(appContext)) {
 572             log.fine("Event posted on wrong app context : " + event);
 573         }
 574         PostEventQueue postEventQueue =
 575             (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
 576         if (postEventQueue != null) {
 577             postEventQueue.postEvent(event);
 578         }
 579     }
 580 
 581     /*
 582      * Post AWTEvent of high priority.
 583      */


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