src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
Print this page
@@ -873,10 +873,25 @@
e.printStackTrace();
}
}
}
+ /**
+ * Helper method to get a pointer to the native view from the PlatformWindow.
+ */
+ static long getNativeViewPtr(PlatformWindow platformWindow) {
+ long nativePeer = 0L;
+ if (platformWindow instanceof CPlatformWindow) {
+ nativePeer = ((CPlatformWindow) platformWindow).getContentView().getAWTView();
+ } else if (platformWindow instanceof CViewPlatformEmbeddedFrame){
+ nativePeer = ((CViewPlatformEmbeddedFrame) platformWindow).getNSViewPtr();
+ } else {
+ throw new IllegalArgumentException("Unsupported platformWindow implementation");
+ }
+ return nativePeer;
+ }
+
/*************************************************************
* Callbacks from the AWTWindow and AWTView objc classes.
*************************************************************/
private void deliverWindowFocusEvent(boolean gained, CPlatformWindow opposite){
// Fix for 7150349: ingore "gained" notifications when the app is inactive.