jdk/src/solaris/native/sun/awt/awt_util.h
changeset 21939 5169fd314636
parent 18754 3db51db1e3d5
child 24165 fb4f67872b27
equal deleted inserted replaced
21938:3a235a461503 21939:5169fd314636
    27 #define _AWT_UTIL_H_
    27 #define _AWT_UTIL_H_
    28 
    28 
    29 #ifndef HEADLESS
    29 #ifndef HEADLESS
    30 #include "gdefs.h"
    30 #include "gdefs.h"
    31 
    31 
    32 /*
    32 #define WITH_XERROR_HANDLER(f) do {             \
    33  * Expected types of arguments of the macro.
    33     XSync(awt_display, False);                  \
    34  * (JNIEnv*, const char*, const char*, jboolean, jobject)
    34     current_native_xerror_handler = (f);        \
    35  */
    35 } while (0)
    36 #define WITH_XERROR_HANDLER(env, handlerClassName, getInstanceSignature,                          \
    36 
    37                             handlerHasFlag, handlerRef) do {                                      \
    37 #define RESTORE_XERROR_HANDLER do {             \
    38     handlerRef = JNU_CallStaticMethodByName(env, NULL, handlerClassName, "getInstance",           \
    38     XSync(awt_display, False);                  \
    39         getInstanceSignature).l;                                                                  \
    39     current_native_xerror_handler = NULL;       \
    40     if (handlerHasFlag == JNI_TRUE) {                                                             \
    40 } while (0)
    41         JNU_CallMethodByName(env, NULL, handlerRef, "setErrorOccurredFlag", "(Z)V", JNI_FALSE);   \
    41 
    42     }                                                                                             \
    42 #define EXEC_WITH_XERROR_HANDLER(f, code) do {  \
    43     JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil", "WITH_XERROR_HANDLER", \
    43     WITH_XERROR_HANDLER(f);                     \
    44         "(Lsun/awt/X11/XErrorHandler;)V", handlerRef);                                            \
    44     do {                                        \
       
    45         code;                                   \
       
    46     } while (0);                                \
       
    47     RESTORE_XERROR_HANDLER;                     \
    45 } while (0)
    48 } while (0)
    46 
    49 
    47 /*
    50 /*
    48  * Expected types of arguments of the macro.
    51  * Called by "ToolkitErrorHandler" function in "XlibWrapper.c" file.
    49  * (JNIEnv*, jboolean)
       
    50  */
    52  */
    51 #define RESTORE_XERROR_HANDLER(env, doXSync) do {                                                 \
    53 extern XErrorHandler current_native_xerror_handler;
    52     JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil",                        \
       
    53         "RESTORE_XERROR_HANDLER", "(Z)V", doXSync);                                               \
       
    54 } while (0)
       
    55 
    54 
    56 /*
       
    57  * Expected types of arguments of the macro.
       
    58  * (JNIEnv*, const char*, const char*, jboolean, jobject, jboolean, No type - C expression)
       
    59  */
       
    60 #define EXEC_WITH_XERROR_HANDLER(env, handlerClassName, getInstanceSignature, handlerHasFlag,     \
       
    61                                  handlerRef, errorOccurredFlag, code) do {                        \
       
    62     handlerRef = NULL;                                                                            \
       
    63     WITH_XERROR_HANDLER(env, handlerClassName, getInstanceSignature, handlerHasFlag, handlerRef); \
       
    64     do {                                                                                          \
       
    65         code;                                                                                     \
       
    66     } while (0);                                                                                  \
       
    67     RESTORE_XERROR_HANDLER(env, JNI_TRUE);                                                        \
       
    68     if (handlerHasFlag == JNI_TRUE) {                                                             \
       
    69         GET_HANDLER_ERROR_OCCURRED_FLAG(env, handlerRef, errorOccurredFlag);                      \
       
    70     }                                                                                             \
       
    71 } while (0)
       
    72 
       
    73 /*
       
    74  * Expected types of arguments of the macro.
       
    75  * (JNIEnv*, jobject, jboolean)
       
    76  */
       
    77 #define GET_HANDLER_ERROR_OCCURRED_FLAG(env, handlerRef, errorOccurredFlag) do {                  \
       
    78     if (handlerRef != NULL) {                                                                     \
       
    79         errorOccurredFlag = JNU_CallMethodByName(env, NULL, handlerRef, "getErrorOccurredFlag",   \
       
    80             "()Z").z;                                                                             \
       
    81     }                                                                                             \
       
    82 } while (0)
       
    83 #endif /* !HEADLESS */
    55 #endif /* !HEADLESS */
    84 
    56 
    85 #ifndef INTERSECTS
    57 #ifndef INTERSECTS
    86 #define INTERSECTS(r1_x1,r1_x2,r1_y1,r1_y2,r2_x1,r2_x2,r2_y1,r2_y2) \
    58 #define INTERSECTS(r1_x1,r1_x2,r1_y1,r1_y2,r2_x1,r2_x2,r2_y1,r2_y2) \
    87 !((r2_x2 <= r1_x1) ||\
    59 !((r2_x2 <= r1_x1) ||\