jdk/src/solaris/native/sun/xawt/XlibWrapper.c
changeset 2802 d05a9dcc8296
parent 2473 3f4bbd3be2f1
child 3088 b0260407a050
equal deleted inserted replaced
2760:f038acdbdf9c 2802:d05a9dcc8296
  1184 
  1184 
  1185 JavaVM* jvm = NULL;
  1185 JavaVM* jvm = NULL;
  1186 static int ToolkitErrorHandler(Display * dpy, XErrorEvent * event) {
  1186 static int ToolkitErrorHandler(Display * dpy, XErrorEvent * event) {
  1187     if (jvm != NULL) {
  1187     if (jvm != NULL) {
  1188         JNIEnv * env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
  1188         JNIEnv * env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
  1189         return JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit", "GlobalErrorHandler", "(JJ)I",
  1189         return JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit", "globalErrorHandler", "(JJ)I",
  1190                                           ptr_to_jlong(dpy), ptr_to_jlong(event)).i;
  1190                                           ptr_to_jlong(dpy), ptr_to_jlong(event)).i;
  1191     } else {
  1191     } else {
  1192         return 0;
  1192         return 0;
  1193     }
  1193     }
  1194 }
  1194 }
  1227 (JNIEnv *env, jclass clazz, jlong handler, jlong display, jlong event_ptr)
  1227 (JNIEnv *env, jclass clazz, jlong handler, jlong display, jlong event_ptr)
  1228 {
  1228 {
  1229     return (*(XErrorHandler)jlong_to_ptr(handler))((Display*) jlong_to_ptr(display), (XErrorEvent*) jlong_to_ptr(event_ptr));
  1229     return (*(XErrorHandler)jlong_to_ptr(handler))((Display*) jlong_to_ptr(display), (XErrorEvent*) jlong_to_ptr(event_ptr));
  1230 }
  1230 }
  1231 
  1231 
       
  1232 /*
       
  1233  * Class:     sun_awt_X11_XlibWrapper
       
  1234  * Method:    PrintXErrorEvent
       
  1235  * Signature: (JJ)V
       
  1236  */
       
  1237 JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_PrintXErrorEvent
       
  1238 (JNIEnv *env, jclass clazz, jlong display, jlong event_ptr)
       
  1239 {
       
  1240     char msg[128];
       
  1241     char buf[128];
       
  1242 
       
  1243     XErrorEvent* err = (XErrorEvent *)jlong_to_ptr(event_ptr);
       
  1244 
       
  1245     XGetErrorText((Display *)jlong_to_ptr(display), err->error_code, msg, sizeof(msg));
       
  1246     jio_fprintf(stderr, "Xerror %s, XID %x, ser# %d\n", msg, err->resourceid, err->serial);
       
  1247     jio_snprintf(buf, sizeof(buf), "%d", err->request_code);
       
  1248     XGetErrorDatabaseText((Display *)jlong_to_ptr(display), "XRequest", buf, "Unknown", msg, sizeof(msg));
       
  1249     jio_fprintf(stderr, "Major opcode %d (%s)\n", err->request_code, msg);
       
  1250     if (err->request_code > 128) {
       
  1251         jio_fprintf(stderr, "Minor opcode %d\n", err->minor_code);
       
  1252     }
       
  1253 }
  1232 
  1254 
  1233 
  1255 
  1234 /*
  1256 /*
  1235  * Class:     sun_awt_X11_XlibWrapper
  1257  * Class:     sun_awt_X11_XlibWrapper
  1236  * Method:    XInternAtoms
  1258  * Method:    XInternAtoms