示例#1
0
 @Override
 public boolean rejectFocusRequest(FocusEvent.Cause cause) {
   // Cross-app activation requests are not allowed.
   if (cause != FocusEvent.Cause.MOUSE_EVENT
       && !((LWCToolkit) Toolkit.getDefaultToolkit()).isApplicationActive()) {
     focusLogger.fine("the app is inactive, so the request is rejected");
     return true;
   }
   return false;
 }
示例#2
0
  /**
   * *********************************************************** Callbacks from the AWTWindow and
   * AWTView objc classes. ***********************************************************
   */
  private void deliverWindowFocusEvent(boolean gained, CPlatformWindow opposite) {
    // Fix for 7150349: ingore "gained" notifications when the app is inactive.
    if (gained && !((LWCToolkit) Toolkit.getDefaultToolkit()).isApplicationActive()) {
      focusLogger.fine("the app is inactive, so the notification is ignored");
      return;
    }

    LWWindowPeer oppositePeer = (opposite == null) ? null : opposite.getPeer();
    responder.handleWindowFocusEvent(gained, oppositePeer);
  }
示例#3
0
 @Override // PlatformWindow
 public void toFront() {
   final long nsWindowPtr = getNSWindowPtr();
   LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
   Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
   final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
   if (w != null
       && acc.getPeer(w) != null
       && ((LWWindowPeer) acc.getPeer(w)).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
       && !lwcToolkit.isApplicationActive()) {
     lwcToolkit.activateApplicationIgnoringOtherApps();
   }
   updateFocusabilityForAutoRequestFocus(false);
   nativePushNSWindowToFront(nsWindowPtr);
   updateFocusabilityForAutoRequestFocus(true);
 }