src/share/classes/java/awt/EventQueue.java

Print this page

        

*** 161,170 **** --- 161,175 ---- /* * The time stamp of the last dispatched InputEvent or ActionEvent. */ private long mostRecentEventTime = System.currentTimeMillis(); + /* + * The time stamp of the last KeyEvent . + */ + private long mostRecentKeyEventTime = System.currentTimeMillis(); + /** * The modifiers field of the current event, if the current event is an * InputEvent or ActionEvent. */ private WeakReference currentEvent;
*** 1136,1145 **** --- 1141,1159 ---- } finally { pushPopLock.unlock(); } } + synchronized long getMostRecentKeyEventTime() { + pushPopLock.lock(); + try { + return mostRecentKeyEventTime; + } finally { + pushPopLock.unlock(); + } + } + static void setCurrentEventAndMostRecentTime(AWTEvent e) { Toolkit.getEventQueue().setCurrentEventAndMostRecentTimeImpl(e); } private void setCurrentEventAndMostRecentTimeImpl(AWTEvent e) { pushPopLock.lock();
*** 1160,1169 **** --- 1174,1186 ---- // will no longer be an issue. long mostRecentEventTime2 = Long.MIN_VALUE; if (e instanceof InputEvent) { InputEvent ie = (InputEvent)e; mostRecentEventTime2 = ie.getWhen(); + if (e instanceof KeyEvent) { + mostRecentKeyEventTime = ie.getWhen(); + } } else if (e instanceof InputMethodEvent) { InputMethodEvent ime = (InputMethodEvent)e; mostRecentEventTime2 = ime.getWhen(); } else if (e instanceof ActionEvent) { ActionEvent ae = (ActionEvent)e;