src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java

Print this page




 858         if (surfaceData instanceof CGLSurfaceData) {
 859             ((CGLSurfaceData)surfaceData).validate();
 860         }
 861     }
 862 
 863     private void flushBuffers() {
 864         if (isVisible() && !nativeBounds.isEmpty()) {
 865             try {
 866                 LWCToolkit.invokeAndWait(new Runnable() {
 867                     @Override
 868                     public void run() {
 869                         //Posting an empty to flush the EventQueue without blocking the main thread
 870                     }
 871                 }, target);
 872             } catch (InterruptedException | InvocationTargetException e) {
 873                 e.printStackTrace();
 874             }
 875         }
 876     }
 877 















 878     /*************************************************************
 879      * Callbacks from the AWTWindow and AWTView objc classes.
 880      *************************************************************/
 881     private void deliverWindowFocusEvent(boolean gained, CPlatformWindow opposite){
 882         // Fix for 7150349: ingore "gained" notifications when the app is inactive.
 883         if (gained && !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) {
 884             focusLogger.fine("the app is inactive, so the notification is ignored");
 885             return;
 886         }
 887 
 888         LWWindowPeer oppositePeer = (opposite == null)? null : opposite.getPeer();
 889         responder.handleWindowFocusEvent(gained, oppositePeer);
 890     }
 891 
 892     private void deliverMoveResizeEvent(int x, int y, int width, int height,
 893                                         boolean byUser) {
 894         // when the content view enters the full-screen mode, the native
 895         // move/resize notifications contain a bounds smaller than
 896         // the whole screen and therefore we ignore the native notifications
 897         // and the content view itself creates correct synthetic notifications




 858         if (surfaceData instanceof CGLSurfaceData) {
 859             ((CGLSurfaceData)surfaceData).validate();
 860         }
 861     }
 862 
 863     private void flushBuffers() {
 864         if (isVisible() && !nativeBounds.isEmpty()) {
 865             try {
 866                 LWCToolkit.invokeAndWait(new Runnable() {
 867                     @Override
 868                     public void run() {
 869                         //Posting an empty to flush the EventQueue without blocking the main thread
 870                     }
 871                 }, target);
 872             } catch (InterruptedException | InvocationTargetException e) {
 873                 e.printStackTrace();
 874             }
 875         }
 876     }
 877 
 878     /**
 879      * Helper method to get a pointer to the native view from the PlatformWindow.
 880      */
 881     static long getNativeViewPtr(PlatformWindow platformWindow) {
 882         long nativePeer = 0L;
 883         if (platformWindow instanceof CPlatformWindow) {
 884             nativePeer = ((CPlatformWindow) platformWindow).getContentView().getAWTView();
 885         } else if (platformWindow instanceof CViewPlatformEmbeddedFrame){
 886             nativePeer = ((CViewPlatformEmbeddedFrame) platformWindow).getNSViewPtr();
 887         } else {
 888             throw new IllegalArgumentException("Unsupported platformWindow implementation");
 889         }
 890         return nativePeer;
 891     }
 892 
 893     /*************************************************************
 894      * Callbacks from the AWTWindow and AWTView objc classes.
 895      *************************************************************/
 896     private void deliverWindowFocusEvent(boolean gained, CPlatformWindow opposite){
 897         // Fix for 7150349: ingore "gained" notifications when the app is inactive.
 898         if (gained && !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) {
 899             focusLogger.fine("the app is inactive, so the notification is ignored");
 900             return;
 901         }
 902 
 903         LWWindowPeer oppositePeer = (opposite == null)? null : opposite.getPeer();
 904         responder.handleWindowFocusEvent(gained, oppositePeer);
 905     }
 906 
 907     private void deliverMoveResizeEvent(int x, int y, int width, int height,
 908                                         boolean byUser) {
 909         // when the content view enters the full-screen mode, the native
 910         // move/resize notifications contain a bounds smaller than
 911         // the whole screen and therefore we ignore the native notifications
 912         // and the content view itself creates correct synthetic notifications