Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/native/sun/awt/awt_util.c
32287 views
1
/*
2
* Copyright (c) 1995, 2014, 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
23
* questions.
24
*/
25
26
/*
27
#ifdef HEADLESS
28
#error This file should not be included in headless library
29
#endif
30
*/
31
32
#include "awt_p.h"
33
#include "color.h"
34
#include <X11/IntrinsicP.h>
35
#include <X11/Xatom.h>
36
#include <X11/Xmd.h>
37
#include <X11/Xutil.h>
38
#include <X11/Xproto.h>
39
#include <jni.h>
40
#include <jni_util.h>
41
#include <sys/time.h>
42
43
44
#include "java_awt_event_MouseWheelEvent.h"
45
46
/*
47
* Called by "ToolkitErrorHandler" function in "XlibWrapper.c" file.
48
*/
49
XErrorHandler current_native_xerror_handler = NULL;
50
51
extern jint getModifiers(uint32_t state, jint button, jint keyCode);
52
extern jint getButton(uint32_t button);
53
54
static Atom OLDecorDelAtom = 0;
55
static Atom MWMHints = 0;
56
static Atom DTWMHints = 0;
57
static Atom decor_list[9];
58
59
#ifndef MAX
60
#define MAX(a,b) ((a) > (b) ? (a) : (b))
61
#endif
62
63
#ifndef MIN
64
#define MIN(a,b) ((a) < (b) ? (a) : (b))
65
#endif
66
67
jboolean
68
awtJNI_ThreadYield(JNIEnv *env) {
69
70
static jclass threadClass = NULL;
71
static jmethodID yieldMethodID = NULL;
72
73
/* Initialize our java identifiers once. Checking before locking
74
* is a huge performance win.
75
*/
76
if (threadClass == NULL) {
77
// should enter a monitor here...
78
Boolean err = FALSE;
79
if (threadClass == NULL) {
80
jclass tc = (*env)->FindClass(env, "java/lang/Thread");
81
CHECK_NULL_RETURN(tc, JNI_FALSE);
82
threadClass = (*env)->NewGlobalRef(env, tc);
83
(*env)->DeleteLocalRef(env, tc);
84
if (threadClass != NULL) {
85
yieldMethodID = (*env)->GetStaticMethodID(env,
86
threadClass,
87
"yield",
88
"()V"
89
);
90
}
91
}
92
if (yieldMethodID == NULL) {
93
threadClass = NULL;
94
err = TRUE;
95
}
96
if (err) {
97
return JNI_FALSE;
98
}
99
} /* threadClass == NULL*/
100
101
(*env)->CallStaticVoidMethod(env, threadClass, yieldMethodID);
102
DASSERT(!((*env)->ExceptionOccurred(env)));
103
return JNI_TRUE;
104
} /* awtJNI_ThreadYield() */
105
106