497 if (!GraphicsEnvironment.isHeadless()) { 498 if (!setAppContext(target, appContext)) { 499 // Target is not a Component/MenuComponent, use the private Map 500 // instead. 501 appContextMap.put(target, appContext); 502 } 503 } 504 } 505 506 /* 507 * Post an AWTEvent to the Java EventQueue, using the PostEventQueue 508 * to avoid possibly calling client code (EventQueueSubclass.postEvent()) 509 * on the toolkit (AWT-Windows/AWT-Motif) thread. This function should 510 * not be called under another lock since it locks the EventQueue. 511 * See bugids 4632918, 4526597. 512 */ 513 public static void postEvent(AppContext appContext, AWTEvent event) { 514 if (event == null) { 515 throw new NullPointerException(); 516 } 517 // All events posted via this method are system-generated. 518 // Placing the following call here reduces considerably the 519 // number of places throughout the toolkit that would 520 // otherwise have to be modified to precisely identify 521 // system-generated events. 522 setSystemGenerated(event); 523 AppContext eventContext = targetToAppContext(event.getSource()); 524 if (eventContext != null && !eventContext.equals(appContext)) { 525 log.fine("Event posted on wrong app context : " + event); 526 } 527 PostEventQueue postEventQueue = 528 (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY); 529 if (postEventQueue != null) { 530 postEventQueue.postEvent(event); 531 } 532 } 533 534 /* 535 * Post AWTEvent of high priority. 536 */ 1948 /** 1949 * Returns the value of "sun.awt.disableMixing" property. Default 1950 * value is {@code false}. 1951 */ 1952 public synchronized static boolean getSunAwtDisableMixing() { 1953 if (sunAwtDisableMixing == null) { 1954 sunAwtDisableMixing = getBooleanSystemProperty("sun.awt.disableMixing"); 1955 } 1956 return sunAwtDisableMixing.booleanValue(); 1957 } 1958 1959 /** 1960 * Returns true if the native GTK libraries are available. The 1961 * default implementation returns false, but UNIXToolkit overrides this 1962 * method to provide a more specific answer. 1963 */ 1964 public boolean isNativeGTKAvailable() { 1965 return false; 1966 } 1967 1968 // Cosntant alpha 1969 public boolean isWindowOpacitySupported() { 1970 return false; 1971 } 1972 1973 // Shaping 1974 public boolean isWindowShapingSupported() { 1975 return false; 1976 } 1977 1978 // Per-pixel alpha 1979 public boolean isWindowTranslucencySupported() { 1980 return false; 1981 } 1982 1983 public boolean isTranslucencyCapable(GraphicsConfiguration gc) { 1984 return false; 1985 } 1986 1987 /** | 497 if (!GraphicsEnvironment.isHeadless()) { 498 if (!setAppContext(target, appContext)) { 499 // Target is not a Component/MenuComponent, use the private Map 500 // instead. 501 appContextMap.put(target, appContext); 502 } 503 } 504 } 505 506 /* 507 * Post an AWTEvent to the Java EventQueue, using the PostEventQueue 508 * to avoid possibly calling client code (EventQueueSubclass.postEvent()) 509 * on the toolkit (AWT-Windows/AWT-Motif) thread. This function should 510 * not be called under another lock since it locks the EventQueue. 511 * See bugids 4632918, 4526597. 512 */ 513 public static void postEvent(AppContext appContext, AWTEvent event) { 514 if (event == null) { 515 throw new NullPointerException(); 516 } 517 518 AWTAccessor.SequencedEventAccessor sea = AWTAccessor.getSequencedEventAccessor(); 519 if (sea != null && sea.isSequencedEvent(event)) { 520 AWTEvent nested = sea.getNested(event); 521 if (nested.getID() == WindowEvent.WINDOW_LOST_FOCUS && 522 nested instanceof TimedWindowEvent) 523 { 524 TimedWindowEvent twe = (TimedWindowEvent)nested; 525 ((SunToolkit)Toolkit.getDefaultToolkit()). 526 setWindowDeactivationTime((Window)twe.getSource(), twe.getWhen()); 527 } 528 } 529 530 // All events posted via this method are system-generated. 531 // Placing the following call here reduces considerably the 532 // number of places throughout the toolkit that would 533 // otherwise have to be modified to precisely identify 534 // system-generated events. 535 setSystemGenerated(event); 536 AppContext eventContext = targetToAppContext(event.getSource()); 537 if (eventContext != null && !eventContext.equals(appContext)) { 538 log.fine("Event posted on wrong app context : " + event); 539 } 540 PostEventQueue postEventQueue = 541 (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY); 542 if (postEventQueue != null) { 543 postEventQueue.postEvent(event); 544 } 545 } 546 547 /* 548 * Post AWTEvent of high priority. 549 */ 1961 /** 1962 * Returns the value of "sun.awt.disableMixing" property. Default 1963 * value is {@code false}. 1964 */ 1965 public synchronized static boolean getSunAwtDisableMixing() { 1966 if (sunAwtDisableMixing == null) { 1967 sunAwtDisableMixing = getBooleanSystemProperty("sun.awt.disableMixing"); 1968 } 1969 return sunAwtDisableMixing.booleanValue(); 1970 } 1971 1972 /** 1973 * Returns true if the native GTK libraries are available. The 1974 * default implementation returns false, but UNIXToolkit overrides this 1975 * method to provide a more specific answer. 1976 */ 1977 public boolean isNativeGTKAvailable() { 1978 return false; 1979 } 1980 1981 private static final Object DEACTIVATION_TIMES_MAP_KEY = new Object(); 1982 1983 public synchronized void setWindowDeactivationTime(Window w, long time) { 1984 AppContext ctx = getAppContext(w); 1985 WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY); 1986 if (map == null) { 1987 map = new WeakHashMap<Window, Long>(); 1988 ctx.put(DEACTIVATION_TIMES_MAP_KEY, map); 1989 } 1990 map.put(w, time); 1991 } 1992 1993 public synchronized long getWindowDeactivationTime(Window w) { 1994 AppContext ctx = getAppContext(w); 1995 WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY); 1996 if (map == null) { 1997 return -1; 1998 } 1999 Long time = map.get(w); 2000 return time == null ? -1 : time; 2001 } 2002 2003 // Cosntant alpha 2004 public boolean isWindowOpacitySupported() { 2005 return false; 2006 } 2007 2008 // Shaping 2009 public boolean isWindowShapingSupported() { 2010 return false; 2011 } 2012 2013 // Per-pixel alpha 2014 public boolean isWindowTranslucencySupported() { 2015 return false; 2016 } 2017 2018 public boolean isTranslucencyCapable(GraphicsConfiguration gc) { 2019 return false; 2020 } 2021 2022 /** |