src/solaris/native/sun/awt/awt_DrawingSurface.c

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -403,19 +403,25 @@
 
     if (peer != NULL) {
         target = (*env)->GetObjectField(env, peer, mComponentPeerIDs.target);
     }
 #else
+    if (window != None) {
+        peer = JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit",
+            "windowToXWindow", "(J)Lsun/awt/X11/XBaseWindow;", (jlong)window).l;
+    }
+    if ((peer != NULL) &&
+        (JNU_IsInstanceOfByName(env, peer, "sun/awt/X11/XWindow") == 1)) {
     target =  (*env)->GetObjectField(env, peer, targetID);
+    }
 #endif
 
     if (target == NULL) {
         JNU_ThrowNullPointerException(env, "NullPointerException");
         AWT_UNLOCK();
         return (jobject)NULL;
     }
 
-
     AWT_UNLOCK();
 
     return target;
 }