318 XWindowPeer wpeer = (XWindowPeer)parentWindow.getPeer();
319 if (wpeer == null) {
320 return rejectFocusRequestHelper("WARNING: Parent window's peer is null");
321 }
322 /*
323 * Passing null 'actualFocusedWindow' as we don't want to restore focus on it
324 * when a component inside a Frame is requesting focus.
325 * See 6314575 for details.
326 */
327 boolean res = wpeer.requestWindowFocus(null);
328
329 if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
330 focusLog.finer("Requested window focus: " + res);
331 }
332 // If parent window can be made focused and has been made focused(synchronously)
333 // then we can proceed with children, otherwise we retreat.
334 if (!(res && parentWindow.isFocused())) {
335 return rejectFocusRequestHelper("Waiting for asynchronous processing of the request");
336 }
337 return XKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
338 (Component)target,
339 temporary,
340 focusedWindowChangeAllowed,
341 time, cause);
342 // Motif compatibility code
343 case XKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
344 // Either lightweight or excessive request - all events are generated.
345 return true;
346 }
347 return false;
348 }
349
350 private boolean rejectFocusRequestHelper(String logMsg) {
351 if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
352 focusLog.finer(logMsg);
353 }
354 XKeyboardFocusManagerPeer.removeLastFocusRequest(target);
355 return false;
356 }
357
358 void handleJavaFocusEvent(AWTEvent e) {
|
318 XWindowPeer wpeer = (XWindowPeer)parentWindow.getPeer();
319 if (wpeer == null) {
320 return rejectFocusRequestHelper("WARNING: Parent window's peer is null");
321 }
322 /*
323 * Passing null 'actualFocusedWindow' as we don't want to restore focus on it
324 * when a component inside a Frame is requesting focus.
325 * See 6314575 for details.
326 */
327 boolean res = wpeer.requestWindowFocus(null);
328
329 if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
330 focusLog.finer("Requested window focus: " + res);
331 }
332 // If parent window can be made focused and has been made focused(synchronously)
333 // then we can proceed with children, otherwise we retreat.
334 if (!(res && parentWindow.isFocused())) {
335 return rejectFocusRequestHelper("Waiting for asynchronous processing of the request");
336 }
337 return XKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
338 target,
339 temporary,
340 focusedWindowChangeAllowed,
341 time, cause);
342 // Motif compatibility code
343 case XKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
344 // Either lightweight or excessive request - all events are generated.
345 return true;
346 }
347 return false;
348 }
349
350 private boolean rejectFocusRequestHelper(String logMsg) {
351 if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
352 focusLog.finer(logMsg);
353 }
354 XKeyboardFocusManagerPeer.removeLastFocusRequest(target);
355 return false;
356 }
357
358 void handleJavaFocusEvent(AWTEvent e) {
|