--- old/src/share/classes/sun/awt/SunToolkit.java 2012-07-05 15:38:34.000000000 +0400 +++ new/src/share/classes/sun/awt/SunToolkit.java 2012-07-05 15:38:34.000000000 +0400 @@ -548,6 +548,19 @@ if (event == null) { throw new NullPointerException(); } + + AWTAccessor.SequencedEventAccessor sea = AWTAccessor.getSequencedEventAccessor(); + if (sea != null && sea.isSequencedEvent(event)) { + AWTEvent nested = sea.getNested(event); + if (nested.getID() == WindowEvent.WINDOW_LOST_FOCUS && + nested instanceof TimedWindowEvent) + { + TimedWindowEvent twe = (TimedWindowEvent)nested; + ((SunToolkit)Toolkit.getDefaultToolkit()). + setDeactivationTime((Window)twe.getSource(), twe.getWhen()); + } + } + // All events posted via this method are system-generated. // Placing the following call here reduces considerably the // number of places throughout the toolkit that would @@ -1961,6 +1974,17 @@ return false; } + private WeakHashMap deactivationTimes = new WeakHashMap(); + + public synchronized void setDeactivationTime(Window w, long time) { + deactivationTimes.put(w, time); + } + + public synchronized long getDeactivationTime(Window w) { + Long time = deactivationTimes.get(w); + return time == null ? -1 : time; + } + // Cosntant alpha public boolean isWindowOpacitySupported() { return false;