src/share/classes/java/awt/DefaultKeyboardFocusManager.java
Print this page
@@ -281,14 +281,24 @@
private boolean repostIfFollowsKeyEvents(WindowEvent e) {
if (!(e instanceof TimedWindowEvent)) {
return false;
}
TimedWindowEvent we = (TimedWindowEvent)e;
+ if (we.isReposted()) {
+ // It is expected that the key events waiting in the type-ahead queue
+ // get dispatched during the first repost cycle. If they don't, there's
+ // likely a dependency b/w the key events and the focus window event
+ // (a type-ahead marker may be targeted at a component belonging to the
+ // window awaiting activation and focus). So, to avoid the risk of endless
+ // repost cycle, a focus window event is not reposted repeatedely. See 8015454.
+ return false;
+ }
long time = we.getWhen();
synchronized (this) {
for (KeyEvent ke: enqueuedKeyEvents) {
if (time >= ke.getWhen()) {
+ we.setReposted();
SunToolkit.postEvent(AppContext.getAppContext(), new SequencedEvent(e));
return true;
}
}
}