< prev index next >

src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c

Print this page


   1 /*
   2  * Copyright (c) 2002, 2015, 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


 556     return XkbQueryExtension( (Display *) jlong_to_ptr(display),
 557                        (int *) jlong_to_ptr(opcode_rtrn),
 558                        (int *) jlong_to_ptr(event_rtrn),
 559                        (int *) jlong_to_ptr(error_rtrn),
 560                        (int *) jlong_to_ptr(major_in_out),
 561                        (int *) jlong_to_ptr(minor_in_out));
 562 }
 563 JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbLibraryVersion
 564 (JNIEnv *env, jclass clazz, jlong lib_major_in_out, jlong lib_minor_in_out)
 565 {
 566     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
 567     *((int *)jlong_to_ptr(lib_major_in_out)) =  XkbMajorVersion;
 568     *((int *)jlong_to_ptr(lib_minor_in_out)) =  XkbMinorVersion;
 569     return  XkbLibraryVersion((int *)jlong_to_ptr(lib_major_in_out), (int *)jlong_to_ptr(lib_minor_in_out));
 570 }
 571 
 572 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XkbGetMap
 573 (JNIEnv *env, jclass clazz, jlong display, jlong which, jlong device_spec)
 574 {
 575     AWT_CHECK_HAVE_LOCK_RETURN(0);
 576     return (jlong) XkbGetMap( (Display *) jlong_to_ptr(display),
 577                               (unsigned int) which,
 578                               (unsigned int) device_spec);
 579 }
 580 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XkbGetUpdatedMap
 581 (JNIEnv *env, jclass clazz, jlong display, jlong which, jlong xkb)
 582 {
 583     AWT_CHECK_HAVE_LOCK_RETURN(0);
 584     return (jlong) XkbGetUpdatedMap( (Display *) jlong_to_ptr(display),
 585                               (unsigned int) which,
 586                               (XkbDescPtr) jlong_to_ptr(xkb));
 587 }
 588 JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbFreeKeyboard
 589 (JNIEnv *env, jclass clazz, jlong xkb, jlong which, jboolean free_all)
 590 {
 591     AWT_CHECK_HAVE_LOCK();
 592     XkbFreeKeyboard(jlong_to_ptr(xkb), (unsigned int)which, free_all);
 593 }
 594 JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbTranslateKeyCode
 595 (JNIEnv *env, jclass clazz, jlong xkb, jint keycode, jlong mods, jlong mods_rtrn, jlong keysym_rtrn)
 596 {
 597     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
 598     Bool b;
 599     b = XkbTranslateKeyCode((XkbDescPtr)xkb, (unsigned int)keycode, (unsigned int)mods,
 600                               (unsigned int *)jlong_to_ptr(mods_rtrn),
 601                                (KeySym *)jlong_to_ptr(keysym_rtrn));
 602     //printf("native,  input: keycode:0x%0X; mods:0x%0X\n", keycode, mods);
 603     //printf("native, output:  keysym:0x%0X; mods:0x%0X\n", *(unsigned int *)jlong_to_ptr(keysym_rtrn), *(unsigned int *)jlong_to_ptr(mods_rtrn));
 604     return b;
 605 }
 606 JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSetDetectableAutoRepeat
 607 (JNIEnv *env, jclass clazz, jlong display, jboolean detectable)
 608 {
 609     AWT_CHECK_HAVE_LOCK();
 610     XkbSetDetectableAutoRepeat((Display *) jlong_to_ptr(display), detectable, NULL);
 611 }
 612 /*
 613  * Class:     sun_awt_X11_XlibWrapper
 614  * Method:    XNextEvent
 615  * Signature: (JJ)V
 616  */
 617 
 618 
 619 JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XNextEvent


2194     if (isCopy) {
2195         (*env)->ReleaseIntArrayElements(env, array, ints, JNI_ABORT);
2196     }
2197 }
2198 
2199 JNIEXPORT void JNICALL
2200 Java_sun_awt_X11_XlibWrapper_copyLongArray(JNIEnv *env,
2201                                            jclass clazz,
2202                                            jlong dest, jobject array, jint size) {
2203     jboolean isCopy = JNI_FALSE;
2204     jlong * longs = (*env)->GetLongArrayElements(env, array, &isCopy);
2205     memcpy(jlong_to_ptr(dest), longs, size);
2206     if (isCopy) {
2207         (*env)->ReleaseLongArrayElements(env, array, longs, JNI_ABORT);
2208     }
2209 }
2210 
2211 JNIEXPORT jint JNICALL
2212 Java_sun_awt_X11_XlibWrapper_XSynchronize(JNIEnv *env, jclass clazz, jlong display, jboolean onoff)
2213 {
2214     return (jint) XSynchronize((Display*)jlong_to_ptr(display), (onoff == JNI_TRUE ? True : False));
2215 }
2216 
2217 JNIEXPORT jboolean JNICALL
2218 Java_sun_awt_X11_XlibWrapper_XShapeQueryExtension
2219 (JNIEnv *env, jclass clazz, jlong display, jlong event_base_return, jlong error_base_return)
2220 {
2221     jboolean status;
2222 
2223     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
2224 
2225     status = XShapeQueryExtension((Display *)jlong_to_ptr(display),
2226             (int *)jlong_to_ptr(event_base_return), (int *)jlong_to_ptr(error_base_return));
2227     return status;
2228 }
2229 
2230 /*
2231  * Class:     XlibWrapper
2232  * Method:    SetRectangularShape
2233  */
2234 


   1 /*
   2  * Copyright (c) 2002, 2016, 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


 556     return XkbQueryExtension( (Display *) jlong_to_ptr(display),
 557                        (int *) jlong_to_ptr(opcode_rtrn),
 558                        (int *) jlong_to_ptr(event_rtrn),
 559                        (int *) jlong_to_ptr(error_rtrn),
 560                        (int *) jlong_to_ptr(major_in_out),
 561                        (int *) jlong_to_ptr(minor_in_out));
 562 }
 563 JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbLibraryVersion
 564 (JNIEnv *env, jclass clazz, jlong lib_major_in_out, jlong lib_minor_in_out)
 565 {
 566     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
 567     *((int *)jlong_to_ptr(lib_major_in_out)) =  XkbMajorVersion;
 568     *((int *)jlong_to_ptr(lib_minor_in_out)) =  XkbMinorVersion;
 569     return  XkbLibraryVersion((int *)jlong_to_ptr(lib_major_in_out), (int *)jlong_to_ptr(lib_minor_in_out));
 570 }
 571 
 572 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XkbGetMap
 573 (JNIEnv *env, jclass clazz, jlong display, jlong which, jlong device_spec)
 574 {
 575     AWT_CHECK_HAVE_LOCK_RETURN(0);
 576     return ptr_to_jlong(XkbGetMap( (Display *) jlong_to_ptr(display),
 577                               (unsigned int) which,
 578                               (unsigned int) device_spec));
 579 }
 580 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XkbGetUpdatedMap
 581 (JNIEnv *env, jclass clazz, jlong display, jlong which, jlong xkb)
 582 {
 583     AWT_CHECK_HAVE_LOCK_RETURN(0);
 584     return (jlong) XkbGetUpdatedMap( (Display *) jlong_to_ptr(display),
 585                               (unsigned int) which,
 586                               (XkbDescPtr) jlong_to_ptr(xkb));
 587 }
 588 JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbFreeKeyboard
 589 (JNIEnv *env, jclass clazz, jlong xkb, jlong which, jboolean free_all)
 590 {
 591     AWT_CHECK_HAVE_LOCK();
 592     XkbFreeKeyboard(jlong_to_ptr(xkb), (unsigned int)which, free_all);
 593 }
 594 JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbTranslateKeyCode
 595 (JNIEnv *env, jclass clazz, jlong xkb, jint keycode, jlong mods, jlong mods_rtrn, jlong keysym_rtrn)
 596 {
 597     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
 598     Bool b;
 599     b = XkbTranslateKeyCode((XkbDescPtr) jlong_to_ptr(xkb), (unsigned int)keycode, (unsigned int)mods,
 600                               (unsigned int *)jlong_to_ptr(mods_rtrn),
 601                                (KeySym *)jlong_to_ptr(keysym_rtrn));
 602     //printf("native,  input: keycode:0x%0X; mods:0x%0X\n", keycode, mods);
 603     //printf("native, output:  keysym:0x%0X; mods:0x%0X\n", *(unsigned int *)jlong_to_ptr(keysym_rtrn), *(unsigned int *)jlong_to_ptr(mods_rtrn));
 604     return b;
 605 }
 606 JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSetDetectableAutoRepeat
 607 (JNIEnv *env, jclass clazz, jlong display, jboolean detectable)
 608 {
 609     AWT_CHECK_HAVE_LOCK();
 610     XkbSetDetectableAutoRepeat((Display *) jlong_to_ptr(display), detectable, NULL);
 611 }
 612 /*
 613  * Class:     sun_awt_X11_XlibWrapper
 614  * Method:    XNextEvent
 615  * Signature: (JJ)V
 616  */
 617 
 618 
 619 JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XNextEvent


2194     if (isCopy) {
2195         (*env)->ReleaseIntArrayElements(env, array, ints, JNI_ABORT);
2196     }
2197 }
2198 
2199 JNIEXPORT void JNICALL
2200 Java_sun_awt_X11_XlibWrapper_copyLongArray(JNIEnv *env,
2201                                            jclass clazz,
2202                                            jlong dest, jobject array, jint size) {
2203     jboolean isCopy = JNI_FALSE;
2204     jlong * longs = (*env)->GetLongArrayElements(env, array, &isCopy);
2205     memcpy(jlong_to_ptr(dest), longs, size);
2206     if (isCopy) {
2207         (*env)->ReleaseLongArrayElements(env, array, longs, JNI_ABORT);
2208     }
2209 }
2210 
2211 JNIEXPORT jint JNICALL
2212 Java_sun_awt_X11_XlibWrapper_XSynchronize(JNIEnv *env, jclass clazz, jlong display, jboolean onoff)
2213 {
2214     return ptr_to_jlong(XSynchronize((Display*)jlong_to_ptr(display), (onoff == JNI_TRUE ? True : False)));
2215 }
2216 
2217 JNIEXPORT jboolean JNICALL
2218 Java_sun_awt_X11_XlibWrapper_XShapeQueryExtension
2219 (JNIEnv *env, jclass clazz, jlong display, jlong event_base_return, jlong error_base_return)
2220 {
2221     jboolean status;
2222 
2223     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
2224 
2225     status = XShapeQueryExtension((Display *)jlong_to_ptr(display),
2226             (int *)jlong_to_ptr(event_base_return), (int *)jlong_to_ptr(error_base_return));
2227     return status;
2228 }
2229 
2230 /*
2231  * Class:     XlibWrapper
2232  * Method:    SetRectangularShape
2233  */
2234 


< prev index next >