883 @Override 884 public void run() { 885 //Posting an empty to flush the EventQueue without blocking the main thread 886 } 887 }, target); 888 } catch (InterruptedException | InvocationTargetException e) { 889 e.printStackTrace(); 890 } 891 } 892 } 893 894 /** 895 * Helper method to get a pointer to the native view from the PlatformWindow. 896 */ 897 static long getNativeViewPtr(PlatformWindow platformWindow) { 898 long nativePeer = 0L; 899 if (platformWindow instanceof CPlatformWindow) { 900 nativePeer = ((CPlatformWindow) platformWindow).getContentView().getAWTView(); 901 } else if (platformWindow instanceof CViewPlatformEmbeddedFrame){ 902 nativePeer = ((CViewPlatformEmbeddedFrame) platformWindow).getNSViewPtr(); 903 } else { 904 throw new IllegalArgumentException("Unsupported platformWindow implementation"); 905 } 906 return nativePeer; 907 } 908 909 /************************************************************* 910 * Callbacks from the AWTWindow and AWTView objc classes. 911 *************************************************************/ 912 private void deliverWindowFocusEvent(boolean gained, CPlatformWindow opposite){ 913 // Fix for 7150349: ingore "gained" notifications when the app is inactive. 914 if (gained && !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) { 915 focusLogger.fine("the app is inactive, so the notification is ignored"); 916 return; 917 } 918 919 LWWindowPeer oppositePeer = (opposite == null)? null : opposite.getPeer(); 920 responder.handleWindowFocusEvent(gained, oppositePeer); 921 } 922 923 protected void deliverMoveResizeEvent(int x, int y, int width, int height, 924 boolean byUser) { | 883 @Override 884 public void run() { 885 //Posting an empty to flush the EventQueue without blocking the main thread 886 } 887 }, target); 888 } catch (InterruptedException | InvocationTargetException e) { 889 e.printStackTrace(); 890 } 891 } 892 } 893 894 /** 895 * Helper method to get a pointer to the native view from the PlatformWindow. 896 */ 897 static long getNativeViewPtr(PlatformWindow platformWindow) { 898 long nativePeer = 0L; 899 if (platformWindow instanceof CPlatformWindow) { 900 nativePeer = ((CPlatformWindow) platformWindow).getContentView().getAWTView(); 901 } else if (platformWindow instanceof CViewPlatformEmbeddedFrame){ 902 nativePeer = ((CViewPlatformEmbeddedFrame) platformWindow).getNSViewPtr(); 903 } 904 return nativePeer; 905 } 906 907 /************************************************************* 908 * Callbacks from the AWTWindow and AWTView objc classes. 909 *************************************************************/ 910 private void deliverWindowFocusEvent(boolean gained, CPlatformWindow opposite){ 911 // Fix for 7150349: ingore "gained" notifications when the app is inactive. 912 if (gained && !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) { 913 focusLogger.fine("the app is inactive, so the notification is ignored"); 914 return; 915 } 916 917 LWWindowPeer oppositePeer = (opposite == null)? null : opposite.getPeer(); 918 responder.handleWindowFocusEvent(gained, oppositePeer); 919 } 920 921 protected void deliverMoveResizeEvent(int x, int y, int width, int height, 922 boolean byUser) { |