src/solaris/native/sun/awt/awt_util.h

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1995, 2004, 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 --- 1,7 ---- /* ! * Copyright (c) 1995, 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
*** 27,72 **** #define _AWT_UTIL_H_ #ifndef HEADLESS #include "gdefs.h" ! #define WITH_XERROR_HANDLER(f) do { \ ! XSync(awt_display, False); \ ! xerror_code = Success; \ ! xerror_saved_handler = XSetErrorHandler(f); \ ! } while (0) ! ! /* Convenience macro for handlers to use */ ! #define XERROR_SAVE(err) do { \ ! xerror_code = (err)->error_code; \ } while (0) ! #define RESTORE_XERROR_HANDLER do { \ ! XSync(awt_display, False); \ ! XSetErrorHandler(xerror_saved_handler); \ } while (0) ! #define EXEC_WITH_XERROR_HANDLER(f, code) do { \ ! WITH_XERROR_HANDLER(f); \ do { \ code; \ } while (0); \ ! RESTORE_XERROR_HANDLER; \ } while (0) - - /* - * Since X reports protocol errors asynchronously, we often need to - * install an error handler that acts like a callback. While that - * specialized handler is installed we save original handler here. - */ - extern XErrorHandler xerror_saved_handler; - - /* - * A place for error handler to report the error code. - */ - extern unsigned char xerror_code; - #endif /* !HEADLESS */ #ifndef INTERSECTS #define INTERSECTS(r1_x1,r1_x2,r1_y1,r1_y2,r2_x1,r2_x2,r2_y1,r2_y2) \ !((r2_x2 <= r1_x1) ||\ --- 27,77 ---- #define _AWT_UTIL_H_ #ifndef HEADLESS #include "gdefs.h" ! /* ! * Expected types of arguments of the macro. ! * (JNIEnv*, const char*, const char*, jboolean, jobject) ! */ ! #define WITH_XERROR_HANDLER(env, handlerClassName, getInstanceSignature, \ ! handlerHasFlag, handlerRef) do { \ ! handlerRef = JNU_CallStaticMethodByName(env, NULL, handlerClassName, "getInstance", \ ! getInstanceSignature).l; \ ! if (handlerHasFlag == JNI_TRUE) { \ ! JNU_CallMethodByName(env, NULL, handlerRef, "setErrorOccurredFlag", "(Z)V", JNI_FALSE); \ ! } \ ! JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil", "WITH_XERROR_HANDLER", \ ! "(Lsun/awt/X11/XErrorHandler;)V", handlerRef); \ } while (0) ! /* ! * Expected types of arguments of the macro. ! * (JNIEnv*) ! */ ! #define RESTORE_XERROR_HANDLER(env) do { \ ! JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil", \ ! "RESTORE_XERROR_HANDLER", "()V"); \ } while (0) ! /* ! * Expected types of arguments of the macro. ! * (JNIEnv*, const char*, const char*, jboolean, jboolean, No type - C expression) ! */ ! #define EXEC_WITH_XERROR_HANDLER(env, handlerClassName, getInstanceSignature, \ ! handlerHasFlag, errorOccurredFlag, code) do { \ ! jobject handlerRef = NULL; \ ! WITH_XERROR_HANDLER(env, handlerClassName, getInstanceSignature, handlerHasFlag, handlerRef); \ do { \ code; \ } while (0); \ ! RESTORE_XERROR_HANDLER(env); \ ! if (handlerHasFlag == JNI_TRUE) { \ ! errorOccurredFlag = JNU_CallMethodByName(env, NULL, handlerRef, "getErrorOccurredFlag", \ ! "()Z").z; \ ! } \ } while (0) #endif /* !HEADLESS */ #ifndef INTERSECTS #define INTERSECTS(r1_x1,r1_x2,r1_y1,r1_y2,r2_x1,r2_x2,r2_y1,r2_y2) \ !((r2_x2 <= r1_x1) ||\