840 }
841
842 public CPlatformView getContentView() {
843 return contentView;
844 }
845
846 @Override
847 public long getLayerPtr() {
848 return contentView.getWindowLayerPtr();
849 }
850
851 private void validateSurface() {
852 SurfaceData surfaceData = getSurfaceData();
853 if (surfaceData instanceof CGLSurfaceData) {
854 ((CGLSurfaceData)surfaceData).validate();
855 }
856 }
857
858 private void flushBuffers() {
859 if (isVisible() && !nativeBounds.isEmpty()) {
860 LWCToolkit.getLWCToolkit().flushPendingEventsOnAppkit(target);
861 }
862 }
863
864 /*************************************************************
865 * Callbacks from the AWTWindow and AWTView objc classes.
866 *************************************************************/
867 private void deliverWindowFocusEvent(boolean gained, CPlatformWindow opposite){
868 // Fix for 7150349: ingore "gained" notifications when the app is inactive.
869 if (gained && !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) {
870 focusLogger.fine("the app is inactive, so the notification is ignored");
871 return;
872 }
873
874 LWWindowPeer oppositePeer = (opposite == null)? null : opposite.getPeer();
875 responder.handleWindowFocusEvent(gained, oppositePeer);
876 }
877
878 private void deliverMoveResizeEvent(int x, int y, int width, int height,
879 boolean byUser) {
880 // when the content view enters the full-screen mode, the native
|
840 }
841
842 public CPlatformView getContentView() {
843 return contentView;
844 }
845
846 @Override
847 public long getLayerPtr() {
848 return contentView.getWindowLayerPtr();
849 }
850
851 private void validateSurface() {
852 SurfaceData surfaceData = getSurfaceData();
853 if (surfaceData instanceof CGLSurfaceData) {
854 ((CGLSurfaceData)surfaceData).validate();
855 }
856 }
857
858 private void flushBuffers() {
859 if (isVisible() && !nativeBounds.isEmpty()) {
860 try {
861 //Post an empty runnable to the eventQueue and wait for it to finish,
862 //Selectors continue to be processed on the Appkit Thread
863 LWCToolkit.invokeAndWait(new Runnable() {
864 @Override
865 public void run() {
866 }
867 }, target);
868 } catch (Exception e) {
869 e.printStackTrace();
870 }
871 }
872 }
873
874 /*************************************************************
875 * Callbacks from the AWTWindow and AWTView objc classes.
876 *************************************************************/
877 private void deliverWindowFocusEvent(boolean gained, CPlatformWindow opposite){
878 // Fix for 7150349: ingore "gained" notifications when the app is inactive.
879 if (gained && !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) {
880 focusLogger.fine("the app is inactive, so the notification is ignored");
881 return;
882 }
883
884 LWWindowPeer oppositePeer = (opposite == null)? null : opposite.getPeer();
885 responder.handleWindowFocusEvent(gained, oppositePeer);
886 }
887
888 private void deliverMoveResizeEvent(int x, int y, int width, int height,
889 boolean byUser) {
890 // when the content view enters the full-screen mode, the native
|