descendant = heavyweight;
}
KeyboardFocusManager manager = getCurrentKeyboardFocusManager(SunToolkit.targetToAppContext(descendant));
FocusEvent currentFocusOwnerEvent = null;
FocusEvent newFocusOwnerEvent = null;
Component currentFocusOwner = manager.getGlobalFocusOwner();
synchronized (heavyweightRequests) {
HeavyweightFocusRequest hwFocusRequest = getLastHWRequest();
if (hwFocusRequest == null &&
heavyweight == manager.getNativeFocusOwner() &&
allowSyncFocusRequests)
{
if (descendant == currentFocusOwner) {
// Redundant request.
return true;
}
// 'heavyweight' owns the native focus and there are no pending
// requests. 'heavyweight' must be a Container and
// 'descendant' must not be the focus owner. Otherwise,
// we would never have gotten this far.
manager.enqueueKeyEvents(time, descendant);
hwFocusRequest =
new HeavyweightFocusRequest(heavyweight, descendant,
temporary, CausedFocusEvent.Cause.UNKNOWN);
heavyweightRequests.add(hwFocusRequest);
if (currentFocusOwner != null) {
currentFocusOwnerEvent =
new FocusEvent(currentFocusOwner,
FocusEvent.FOCUS_LOST,
temporary, descendant);
}
newFocusOwnerEvent =
new FocusEvent(descendant, FocusEvent.FOCUS_GAINED,
temporary, currentFocusOwner);
}
}
boolean result = false;
final boolean clearing = clearingCurrentLightweightRequests;