Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/native/sun/awt/awt_util.h
32287 views
/*1* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef _AWT_UTIL_H_26#define _AWT_UTIL_H_2728#ifndef HEADLESS29#include "gdefs.h"3031#define WITH_XERROR_HANDLER(f) do { \32XSync(awt_display, False); \33current_native_xerror_handler = (f); \34} while (0)3536#define RESTORE_XERROR_HANDLER do { \37XSync(awt_display, False); \38current_native_xerror_handler = NULL; \39} while (0)4041#define EXEC_WITH_XERROR_HANDLER(f, code) do { \42WITH_XERROR_HANDLER(f); \43do { \44code; \45} while (0); \46RESTORE_XERROR_HANDLER; \47} while (0)4849/*50* Called by "ToolkitErrorHandler" function in "XlibWrapper.c" file.51*/52extern XErrorHandler current_native_xerror_handler;5354Window get_xawt_root_shell(JNIEnv *env);5556#endif /* !HEADLESS */5758#ifndef INTERSECTS59#define INTERSECTS(r1_x1,r1_x2,r1_y1,r1_y2,r2_x1,r2_x2,r2_y1,r2_y2) \60!((r2_x2 <= r1_x1) ||\61(r2_y2 <= r1_y1) ||\62(r2_x1 >= r1_x2) ||\63(r2_y1 >= r1_y2))64#endif6566#ifndef MIN67#define MIN(a,b) ((a) < (b) ? (a) : (b))68#endif69#ifndef MAX70#define MAX(a,b) ((a) > (b) ? (a) : (b))71#endif7273struct DPos {74int32_t x;75int32_t y;76int32_t mapped;77void *data;78void *peer;79int32_t echoC;80};8182extern jboolean awtJNI_ThreadYield(JNIEnv *env);8384/*85* Functions for accessing fields by name and signature86*/8788JNIEXPORT jobject JNICALL89JNU_GetObjectField(JNIEnv *env, jobject self, const char *name,90const char *sig);9192JNIEXPORT jboolean JNICALL93JNU_SetObjectField(JNIEnv *env, jobject self, const char *name,94const char *sig, jobject val);9596JNIEXPORT jlong JNICALL97JNU_GetLongField(JNIEnv *env, jobject self, const char *name);9899JNIEXPORT jint JNICALL100JNU_GetIntField(JNIEnv *env, jobject self, const char *name);101102JNIEXPORT jboolean JNICALL103JNU_SetIntField(JNIEnv *env, jobject self, const char *name, jint val);104105JNIEXPORT jboolean JNICALL106JNU_SetLongField(JNIEnv *env, jobject self, const char *name, jlong val);107108JNIEXPORT jboolean JNICALL109JNU_GetBooleanField(JNIEnv *env, jobject self, const char *name);110111JNIEXPORT jboolean JNICALL112JNU_SetBooleanField(JNIEnv *env, jobject self, const char *name, jboolean val);113114JNIEXPORT jint JNICALL115JNU_GetCharField(JNIEnv *env, jobject self, const char *name);116117#endif /* _AWT_UTIL_H_ */118119120