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

Print this page




 445         if (!GraphicsEnvironment.isHeadless()) {
 446             if (!setAppContext(target, appContext)) {
 447                 // Target is not a Component/MenuComponent, use the private Map
 448                 // instead.
 449                 appContextMap.put(target, appContext);
 450             }
 451         }
 452     }
 453 
 454     /*
 455      * Post an AWTEvent to the Java EventQueue, using the PostEventQueue
 456      * to avoid possibly calling client code (EventQueueSubclass.postEvent())
 457      * on the toolkit (AWT-Windows/AWT-Motif) thread.  This function should
 458      * not be called under another lock since it locks the EventQueue.
 459      * See bugids 4632918, 4526597.
 460      */
 461     public static void postEvent(AppContext appContext, AWTEvent event) {
 462         if (event == null) {
 463             throw new NullPointerException();
 464         }













 465         // All events posted via this method are system-generated.
 466         // Placing the following call here reduces considerably the
 467         // number of places throughout the toolkit that would
 468         // otherwise have to be modified to precisely identify
 469         // system-generated events.
 470         setSystemGenerated(event);
 471         AppContext eventContext = targetToAppContext(event.getSource());
 472         if (eventContext != null && !eventContext.equals(appContext)) {
 473             log.fine("Event posted on wrong app context : " + event);
 474         }
 475         PostEventQueue postEventQueue =
 476             (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
 477         if (postEventQueue != null) {
 478             postEventQueue.postEvent(event);
 479         }
 480     }
 481 
 482     /*
 483      * Post AWTEvent of high priority.
 484      */


1838 
1839     /**
1840      * Returns the value of "sun.awt.disableMixing" property. Default
1841      * value is {@code false}.
1842      */
1843     public synchronized static boolean getSunAwtDisableMixing() {
1844         if (sunAwtDisableMixing == null) {
1845             sunAwtDisableMixing = AccessController.doPrivileged(
1846                                       new GetBooleanAction("sun.awt.disableMixing"));
1847         }
1848         return sunAwtDisableMixing.booleanValue();
1849     }
1850 
1851     /**
1852      * Returns true if the native GTK libraries are available.  The
1853      * default implementation returns false, but UNIXToolkit overrides this
1854      * method to provide a more specific answer.
1855      */
1856     public boolean isNativeGTKAvailable() {
1857         return false;






















1858     }
1859 
1860     // Cosntant alpha
1861     public boolean isWindowOpacitySupported() {
1862         return false;
1863     }
1864 
1865     // Shaping
1866     public boolean isWindowShapingSupported() {
1867         return false;
1868     }
1869 
1870     // Per-pixel alpha
1871     public boolean isWindowTranslucencySupported() {
1872         return false;
1873     }
1874 
1875     public boolean isTranslucencyCapable(GraphicsConfiguration gc) {
1876         return false;
1877     }




 445         if (!GraphicsEnvironment.isHeadless()) {
 446             if (!setAppContext(target, appContext)) {
 447                 // Target is not a Component/MenuComponent, use the private Map
 448                 // instead.
 449                 appContextMap.put(target, appContext);
 450             }
 451         }
 452     }
 453 
 454     /*
 455      * Post an AWTEvent to the Java EventQueue, using the PostEventQueue
 456      * to avoid possibly calling client code (EventQueueSubclass.postEvent())
 457      * on the toolkit (AWT-Windows/AWT-Motif) thread.  This function should
 458      * not be called under another lock since it locks the EventQueue.
 459      * See bugids 4632918, 4526597.
 460      */
 461     public static void postEvent(AppContext appContext, AWTEvent event) {
 462         if (event == null) {
 463             throw new NullPointerException();
 464         }
 465         
 466         AWTAccessor.SequencedEventAccessor sea = AWTAccessor.getSequencedEventAccessor();
 467         if (sea != null && sea.isSequencedEvent(event)) {
 468             AWTEvent nested = sea.getNested(event);
 469             if (nested.getID() == WindowEvent.WINDOW_LOST_FOCUS &&
 470                 nested instanceof TimedWindowEvent)
 471             {
 472                 TimedWindowEvent twe = (TimedWindowEvent)nested;
 473                 ((SunToolkit)Toolkit.getDefaultToolkit()).
 474                     setWindowDeactivationTime((Window)twe.getSource(), twe.getWhen());
 475             }
 476         }
 477         
 478         // All events posted via this method are system-generated.
 479         // Placing the following call here reduces considerably the
 480         // number of places throughout the toolkit that would
 481         // otherwise have to be modified to precisely identify
 482         // system-generated events.
 483         setSystemGenerated(event);
 484         AppContext eventContext = targetToAppContext(event.getSource());
 485         if (eventContext != null && !eventContext.equals(appContext)) {
 486             log.fine("Event posted on wrong app context : " + event);
 487         }
 488         PostEventQueue postEventQueue =
 489             (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
 490         if (postEventQueue != null) {
 491             postEventQueue.postEvent(event);
 492         }
 493     }
 494 
 495     /*
 496      * Post AWTEvent of high priority.
 497      */


1851 
1852     /**
1853      * Returns the value of "sun.awt.disableMixing" property. Default
1854      * value is {@code false}.
1855      */
1856     public synchronized static boolean getSunAwtDisableMixing() {
1857         if (sunAwtDisableMixing == null) {
1858             sunAwtDisableMixing = AccessController.doPrivileged(
1859                                       new GetBooleanAction("sun.awt.disableMixing"));
1860         }
1861         return sunAwtDisableMixing.booleanValue();
1862     }
1863 
1864     /**
1865      * Returns true if the native GTK libraries are available.  The
1866      * default implementation returns false, but UNIXToolkit overrides this
1867      * method to provide a more specific answer.
1868      */
1869     public boolean isNativeGTKAvailable() {
1870         return false;
1871     }
1872 
1873     private static final Object DEACTIVATION_TIMES_MAP_KEY = new Object();
1874 
1875     public synchronized void setWindowDeactivationTime(Window w, long time) {
1876         AppContext ctx = getAppContext(w);
1877         WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
1878         if (map == null) {
1879             map = new WeakHashMap<Window, Long>();
1880             ctx.put(DEACTIVATION_TIMES_MAP_KEY, map);
1881         }
1882         map.put(w, time);
1883     }
1884 
1885     public synchronized long getWindowDeactivationTime(Window w) {
1886         AppContext ctx = getAppContext(w);
1887         WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
1888         if (map == null) {
1889             return -1;
1890         }
1891         Long time = map.get(w);
1892         return time == null ? -1 : time;
1893     }
1894 
1895     // Cosntant alpha
1896     public boolean isWindowOpacitySupported() {
1897         return false;
1898     }
1899 
1900     // Shaping
1901     public boolean isWindowShapingSupported() {
1902         return false;
1903     }
1904 
1905     // Per-pixel alpha
1906     public boolean isWindowTranslucencySupported() {
1907         return false;
1908     }
1909 
1910     public boolean isTranslucencyCapable(GraphicsConfiguration gc) {
1911         return false;
1912     }