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

Print this page


   1 /*
   2  * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 388     Window window = (Window)platformInfo;
 389     Widget widget = NULL;
 390     jobject peer = NULL;
 391     jobject target = NULL;
 392 
 393     AWT_LOCK();
 394 
 395 #ifndef XAWT
 396     if (window != None) {
 397         widget = XtWindowToWidget(awt_display, window);
 398     }
 399 
 400     if (widget != NULL) {
 401         XtVaGetValues (widget, XmNuserData, &peer, NULL);
 402     }
 403 
 404     if (peer != NULL) {
 405         target = (*env)->GetObjectField(env, peer, mComponentPeerIDs.target);
 406     }
 407 #else






 408     target =  (*env)->GetObjectField(env, peer, targetID);

 409 #endif
 410 
 411     if (target == NULL) {
 412         JNU_ThrowNullPointerException(env, "NullPointerException");
 413         AWT_UNLOCK();
 414         return (jobject)NULL;
 415     }
 416 
 417 
 418     AWT_UNLOCK();
 419 
 420     return target;
 421 }
   1 /*
   2  * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 388     Window window = (Window)platformInfo;
 389     Widget widget = NULL;
 390     jobject peer = NULL;
 391     jobject target = NULL;
 392 
 393     AWT_LOCK();
 394 
 395 #ifndef XAWT
 396     if (window != None) {
 397         widget = XtWindowToWidget(awt_display, window);
 398     }
 399 
 400     if (widget != NULL) {
 401         XtVaGetValues (widget, XmNuserData, &peer, NULL);
 402     }
 403 
 404     if (peer != NULL) {
 405         target = (*env)->GetObjectField(env, peer, mComponentPeerIDs.target);
 406     }
 407 #else
 408     if (window != None) {
 409         peer = JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit",
 410             "windowToXWindow", "(J)Lsun/awt/X11/XBaseWindow;", (jlong)window).l;
 411     }
 412     if ((peer != NULL) &&
 413         (JNU_IsInstanceOfByName(env, peer, "sun/awt/X11/XWindow") == 1)) {
 414         target = (*env)->GetObjectField(env, peer, targetID);
 415     }
 416 #endif
 417 
 418     if (target == NULL) {
 419         JNU_ThrowNullPointerException(env, "NullPointerException");
 420         AWT_UNLOCK();
 421         return (jobject)NULL;
 422     }

 423 
 424     AWT_UNLOCK();
 425 
 426     return target;
 427 }