Example #1
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);
 }
Example #2
0
 void flushBuffers() {
   if (isVisible() && !nativeBounds.isEmpty() && !isFullScreenMode) {
     try {
       LWCToolkit.invokeAndWait(
           new Runnable() {
             @Override
             public void run() {
               // Posting an empty to flush the EventQueue without blocking the main thread
             }
           },
           target);
     } catch (InvocationTargetException e) {
       e.printStackTrace();
     }
   }
 }
Example #3
0
  private void maximize() {
    if (peer == null || isMaximized()) {
      return;
    }
    if (!undecorated) {
      CWrapper.NSWindow.zoom(getNSWindowPtr());
    } else {
      deliverZoom(true);

      // We need an up to date size of the peer, so we flush the native events
      // to be sure that there are no setBounds requests in the queue.
      LWCToolkit.flushNativeSelectors();
      this.normalBounds = peer.getBounds();
      Rectangle maximizedBounds = peer.getMaximizedBounds();
      setBounds(
          maximizedBounds.x, maximizedBounds.y, maximizedBounds.width, maximizedBounds.height);
    }
  }