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


 329 JNIEXPORT void JNICALL
 330     awt_Lock(JNIEnv* env)
 331 {
 332     if (awtLockInited) {
 333         AWT_LOCK();
 334     }
 335 }
 336 
 337 JNIEXPORT void JNICALL
 338     awt_Unlock(JNIEnv* env)
 339 {
 340     if (awtLockInited) {
 341         AWT_FLUSH_UNLOCK();
 342     }
 343 }
 344 
 345 JNIEXPORT jobject JNICALL
 346     awt_GetComponent(JNIEnv* env, void* platformInfo)
 347 {
 348     Window window = (Window)platformInfo;
 349     Widget widget = NULL;
 350     jobject peer = NULL;
 351     jobject target = NULL;
 352 
 353     AWT_LOCK();
 354 






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

 356 
 357     if (target == NULL) {
 358         JNU_ThrowNullPointerException(env, "NullPointerException");
 359         AWT_UNLOCK();
 360         return (jobject)NULL;
 361     }
 362 
 363 
 364     AWT_UNLOCK();
 365 
 366     return target;
 367 }
   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


 329 JNIEXPORT void JNICALL
 330     awt_Lock(JNIEnv* env)
 331 {
 332     if (awtLockInited) {
 333         AWT_LOCK();
 334     }
 335 }
 336 
 337 JNIEXPORT void JNICALL
 338     awt_Unlock(JNIEnv* env)
 339 {
 340     if (awtLockInited) {
 341         AWT_FLUSH_UNLOCK();
 342     }
 343 }
 344 
 345 JNIEXPORT jobject JNICALL
 346     awt_GetComponent(JNIEnv* env, void* platformInfo)
 347 {
 348     Window window = (Window)platformInfo;

 349     jobject peer = NULL;
 350     jobject target = NULL;
 351 
 352     AWT_LOCK();
 353 
 354     if (window != None) {
 355         peer = JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit",
 356             "windowToXWindow", "(J)Lsun/awt/X11/XBaseWindow;", (jlong)window).l;
 357     }
 358     if ((peer != NULL) &&
 359         (JNU_IsInstanceOfByName(env, peer, "sun/awt/X11/XWindow") == 1)) {
 360         target = (*env)->GetObjectField(env, peer, targetID);
 361     }
 362 
 363     if (target == NULL) {
 364         JNU_ThrowNullPointerException(env, "NullPointerException");
 365         AWT_UNLOCK();
 366         return (jobject)NULL;
 367     }

 368 
 369     AWT_UNLOCK();
 370 
 371     return target;
 372 }