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