655 @Override // PlatformWindow 656 public void toBack() { 657 final long nsWindowPtr = getNSWindowPtr(); 658 nativePushNSWindowToBack(nsWindowPtr); 659 } 660 661 @Override // PlatformWindow 662 public void toFront() { 663 final long nsWindowPtr = getNSWindowPtr(); 664 updateFocusabilityForAutoRequestFocus(false); 665 nativePushNSWindowToFront(nsWindowPtr); 666 updateFocusabilityForAutoRequestFocus(true); 667 } 668 669 @Override 670 public void setResizable(boolean resizable) { 671 setStyleBits(RESIZABLE, resizable); 672 673 // Re-apply the size constraints and the size to ensure the space 674 // occupied by the grow box is counted properly 675 setMinimumSize(1, 1); // the method ignores its arguments 676 677 Rectangle bounds = peer.getBounds(); 678 setBounds(bounds.x, bounds.y, bounds.width, bounds.height); 679 } 680 681 @Override 682 public void setMinimumSize(int width, int height) { 683 //TODO width, height should be used 684 //NOTE: setResizable() calls setMinimumSize(1,1) relaying on the logic below 685 final long nsWindowPtr = getNSWindowPtr(); 686 final Dimension min = target.getMinimumSize(); 687 final Dimension max = target.getMaximumSize(); 688 nativeSetNSWindowMinMax(nsWindowPtr, min.getWidth(), min.getHeight(), max.getWidth(), max.getHeight()); 689 } 690 691 @Override 692 public boolean rejectFocusRequest(CausedFocusEvent.Cause cause) { 693 // Cross-app activation requests are not allowed. 694 if (cause != CausedFocusEvent.Cause.MOUSE_EVENT && 695 !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) 696 { 697 focusLogger.fine("the app is inactive, so the request is rejected"); 698 return true; 699 } 700 return false; 701 } 702 703 @Override 704 public boolean requestWindowFocus() { 705 706 long ptr = getNSWindowPtr(); 707 if (CWrapper.NSWindow.canBecomeMainWindow(ptr)) { | 655 @Override // PlatformWindow 656 public void toBack() { 657 final long nsWindowPtr = getNSWindowPtr(); 658 nativePushNSWindowToBack(nsWindowPtr); 659 } 660 661 @Override // PlatformWindow 662 public void toFront() { 663 final long nsWindowPtr = getNSWindowPtr(); 664 updateFocusabilityForAutoRequestFocus(false); 665 nativePushNSWindowToFront(nsWindowPtr); 666 updateFocusabilityForAutoRequestFocus(true); 667 } 668 669 @Override 670 public void setResizable(boolean resizable) { 671 setStyleBits(RESIZABLE, resizable); 672 673 // Re-apply the size constraints and the size to ensure the space 674 // occupied by the grow box is counted properly 675 peer.updateMinimumSize(); 676 677 Rectangle bounds = peer.getBounds(); 678 setBounds(bounds.x, bounds.y, bounds.width, bounds.height); 679 } 680 681 @Override 682 public void setSizeConstraints(int minW, int minH, int maxW, int maxH) { 683 final long nsWindowPtr = getNSWindowPtr(); 684 685 final Dimension min; 686 if (target.isMinimumSizeSet()) { 687 min = target.getMinimumSize(); 688 min.width = Math.max(min.width, minW); 689 min.height = Math.max(min.height, minH); 690 } else { 691 min = new Dimension(minW, minH); 692 } 693 694 final Dimension max; 695 if (target.isMaximumSizeSet()) { 696 max = target.getMaximumSize(); 697 max.width = Math.min(max.width, maxW); 698 max.height = Math.min(max.height, maxH); 699 } else { 700 max = new Dimension(maxW, maxH); 701 } 702 703 nativeSetNSWindowMinMax(nsWindowPtr, min.getWidth(), min.getHeight(), max.getWidth(), max.getHeight()); 704 } 705 706 @Override 707 public boolean rejectFocusRequest(CausedFocusEvent.Cause cause) { 708 // Cross-app activation requests are not allowed. 709 if (cause != CausedFocusEvent.Cause.MOUSE_EVENT && 710 !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) 711 { 712 focusLogger.fine("the app is inactive, so the request is rejected"); 713 return true; 714 } 715 return false; 716 } 717 718 @Override 719 public boolean requestWindowFocus() { 720 721 long ptr = getNSWindowPtr(); 722 if (CWrapper.NSWindow.canBecomeMainWindow(ptr)) { |