mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2026-01-08 09:31:42 +01:00
Compare commits
304 Commits
jbr17.617
...
mkartash/J
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4850d9e95 | ||
|
|
1ec391b98e | ||
|
|
e73fb34bcb | ||
|
|
be213a702a | ||
|
|
634024c88a | ||
|
|
1083908208 | ||
|
|
b6d53a51bb | ||
|
|
0834905769 | ||
|
|
47f3b96189 | ||
|
|
1f6f56236a | ||
|
|
a5ef76dd2b | ||
|
|
1cdc498224 | ||
|
|
197d5535dd | ||
|
|
87aa05a5f1 | ||
|
|
c64af6d279 | ||
|
|
650ebe9783 | ||
|
|
5e07ac8c37 | ||
|
|
24d1955187 | ||
|
|
0328a23a47 | ||
|
|
deebf4b9ba | ||
|
|
9603108db9 | ||
|
|
c39f2c2663 | ||
|
|
7aa25a24b6 | ||
|
|
d1babaa2bb | ||
|
|
874d55a8fe | ||
|
|
87c70dd55a | ||
|
|
ed0f24b77b | ||
|
|
8c02c35b02 | ||
|
|
cbafe41848 | ||
|
|
9f56ca7702 | ||
|
|
ded1ee114b | ||
|
|
e72a7455d3 | ||
|
|
208cdad077 | ||
|
|
c5796bd7f3 | ||
|
|
b2882e01f5 | ||
|
|
7f3bf50921 | ||
|
|
d2b1927313 | ||
|
|
cbcd531db7 | ||
|
|
527c0bed4e | ||
|
|
2686fa90d6 | ||
|
|
f99107d49f | ||
|
|
3fd2eda178 | ||
|
|
7d83890c26 | ||
|
|
b431745af8 | ||
|
|
d0eaa9a4a8 | ||
|
|
c6dd06f6bd | ||
|
|
d6bc3568e0 | ||
|
|
95ad47f4aa | ||
|
|
24ecdb69dc | ||
|
|
2ef7a63f4e | ||
|
|
2da35198c8 | ||
|
|
cc55bfd8a2 | ||
|
|
4ffb4bd53b | ||
|
|
2fc8a843c3 | ||
|
|
76e05d2659 | ||
|
|
9f9682fad1 | ||
|
|
0e4074b530 | ||
|
|
cacccf9aaf | ||
|
|
55c2b1fc4e | ||
|
|
a6ade2cb39 | ||
|
|
7bc0973dc1 | ||
|
|
8ea6ee234f | ||
|
|
5d94d04dbc | ||
|
|
a66d622a63 | ||
|
|
b341d8a51d | ||
|
|
e2320ede13 | ||
|
|
60431cb033 | ||
|
|
9cd8227a97 | ||
|
|
3b835e5645 | ||
|
|
a13c21c73a | ||
|
|
2cb492b05d | ||
|
|
3747f82fda | ||
|
|
d70faac6c5 | ||
|
|
1ca780867b | ||
|
|
15a2c269f6 | ||
|
|
aaca19bb8e | ||
|
|
6c58ebdf87 | ||
|
|
f7b9ecd643 | ||
|
|
aad01122cf | ||
|
|
534e7641ac | ||
|
|
1cf7d8a023 | ||
|
|
d59ec46092 | ||
|
|
1a492433b9 | ||
|
|
841ee759df | ||
|
|
646fd15a43 | ||
|
|
11e83ea8ce | ||
|
|
ed10962c11 | ||
|
|
1df7a0abc3 | ||
|
|
9f6d4b02f0 | ||
|
|
7d3f3aa12f | ||
|
|
de2549bffc | ||
|
|
66ec18a5f0 | ||
|
|
82478b3251 | ||
|
|
5233011504 | ||
|
|
3fb690c31f | ||
|
|
89e00ff868 | ||
|
|
edf8a7a800 | ||
|
|
55e0fe0dbc | ||
|
|
f1f9b15234 | ||
|
|
dd10c6646e | ||
|
|
3ec8a7a9a9 | ||
|
|
19700aeac3 | ||
|
|
322d1544de | ||
|
|
9d6e9e568f | ||
|
|
8f82619b9f | ||
|
|
29167f0922 | ||
|
|
46244e7636 | ||
|
|
e3fa2d51cd | ||
|
|
0ec7e6675e | ||
|
|
63c3b2ed4f | ||
|
|
2f18ef43d3 | ||
|
|
2e72aa4b27 | ||
|
|
077e1ead3d | ||
|
|
f9f11992e0 | ||
|
|
0f048a6684 | ||
|
|
ae05c0dc0d | ||
|
|
6173ee93f1 | ||
|
|
34eeb2ce04 | ||
|
|
3ca52fa81a | ||
|
|
8c940e4146 | ||
|
|
fa027785b0 | ||
|
|
5ab077365d | ||
|
|
75bd0c709a | ||
|
|
2be36fd147 | ||
|
|
b391f081b5 | ||
|
|
138bd0ca88 | ||
|
|
80ea32f1d2 | ||
|
|
a6aabec7ae | ||
|
|
391603512d | ||
|
|
4d7398e903 | ||
|
|
676a2d68e0 | ||
|
|
f9be3102c9 | ||
|
|
39a6339bf0 | ||
|
|
8fb526b66c | ||
|
|
16eaf17e35 | ||
|
|
13f8f8b5a8 | ||
|
|
340116e9a9 | ||
|
|
eb557d0dfd | ||
|
|
e68e0d75ae | ||
|
|
6fdb24eaa6 | ||
|
|
87702f4859 | ||
|
|
9a4878d6df | ||
|
|
4f0f874852 | ||
|
|
9592d7f707 | ||
|
|
a84d41c80f | ||
|
|
c3052f0f70 | ||
|
|
23ecac95b1 | ||
|
|
9c87eeeadf | ||
|
|
d931711d7c | ||
|
|
8881306dcd | ||
|
|
04d270e97b | ||
|
|
0521ea9a42 | ||
|
|
edc1f6acf8 | ||
|
|
11510177c5 | ||
|
|
e05942028c | ||
|
|
0f2c29dc44 | ||
|
|
ceee1fd4df | ||
|
|
db4e8a3add | ||
|
|
3995567d62 | ||
|
|
0db94e3118 | ||
|
|
2884ed4e55 | ||
|
|
068be19a2f | ||
|
|
85f4e537d1 | ||
|
|
45210435cf | ||
|
|
c480a2dbf1 | ||
|
|
ded13e196e | ||
|
|
571b532e4a | ||
|
|
ed86c36661 | ||
|
|
7bed060528 | ||
|
|
e8919f69bf | ||
|
|
97b6989f7e | ||
|
|
b4e914c598 | ||
|
|
69901ee2ae | ||
|
|
e80095cbbb | ||
|
|
2f6484fc04 | ||
|
|
3a0ff5f8e7 | ||
|
|
524e6fca1c | ||
|
|
d7a5f009b4 | ||
|
|
1a4c711bee | ||
|
|
127aac5048 | ||
|
|
5784f0fc93 | ||
|
|
e32f73e792 | ||
|
|
ee44a598de | ||
|
|
3993897d0c | ||
|
|
93184aeda8 | ||
|
|
b865c002ba | ||
|
|
a4ee35adb4 | ||
|
|
4d171c961d | ||
|
|
e71964b3cd | ||
|
|
0385996b9d | ||
|
|
32147193a6 | ||
|
|
6d9c78df76 | ||
|
|
9526d4ad67 | ||
|
|
08d5e3c0ec | ||
|
|
f44f5ca2ef | ||
|
|
43f3e70495 | ||
|
|
6f6fde9676 | ||
|
|
0326271feb | ||
|
|
b24ab129a9 | ||
|
|
66b637e2a0 | ||
|
|
dbf3faaf78 | ||
|
|
a4083f2d97 | ||
|
|
57d88f1ae3 | ||
|
|
f5d1b42145 | ||
|
|
26002e711c | ||
|
|
46ca7f91f9 | ||
|
|
a8c6a42789 | ||
|
|
55316fcd42 | ||
|
|
8f5df0c2e0 | ||
|
|
b8a848a0a1 | ||
|
|
3dc983f494 | ||
|
|
d38084d1b7 | ||
|
|
a3180b1137 | ||
|
|
632636e8e4 | ||
|
|
3d204f8be6 | ||
|
|
d693bf5605 | ||
|
|
a58c0b57c0 | ||
|
|
7252596a68 | ||
|
|
2e55e09e3f | ||
|
|
f3e44e4982 | ||
|
|
bb61917806 | ||
|
|
0e609d0340 | ||
|
|
afc221ac87 | ||
|
|
395f1db843 | ||
|
|
b31cfa2f65 | ||
|
|
d6f8c7a0f6 | ||
|
|
28681e649a | ||
|
|
87f63d5c42 | ||
|
|
e93ec19534 | ||
|
|
e02a79321e | ||
|
|
9866a26809 | ||
|
|
d4cd137bcb | ||
|
|
40197b975b | ||
|
|
e198e9e42d | ||
|
|
058560a46b | ||
|
|
2f0e6bb6e5 | ||
|
|
4c83332a4d | ||
|
|
bf641b1d96 | ||
|
|
15c2822499 | ||
|
|
b61e554077 | ||
|
|
42d1ea7152 | ||
|
|
84489b10d0 | ||
|
|
272578cedc | ||
|
|
7b55c53f9c | ||
|
|
40b1874eaa | ||
|
|
233b897c32 | ||
|
|
d7d8826d20 | ||
|
|
b2c70ac401 | ||
|
|
79fe35402f | ||
|
|
27be767641 | ||
|
|
555eb2c11d | ||
|
|
8bfcb91055 | ||
|
|
6b3085bcfc | ||
|
|
de44a84fe6 | ||
|
|
fa6000cf15 | ||
|
|
dc2b2d9c2e | ||
|
|
9c742187e9 | ||
|
|
ebb238ba17 | ||
|
|
bff39eae86 | ||
|
|
fa9a4b9742 | ||
|
|
36f40cde58 | ||
|
|
a6733ca842 | ||
|
|
a57350d46e | ||
|
|
83ef7a38a1 | ||
|
|
5b12ba3f8e | ||
|
|
8e86767f1f | ||
|
|
e60a9a08c1 | ||
|
|
fedaa584bb | ||
|
|
8a39aaff64 | ||
|
|
da28b4dbdd | ||
|
|
e16b31fd8b | ||
|
|
e1ca682a0f | ||
|
|
b73fa25c44 | ||
|
|
f7a9dbc918 | ||
|
|
bfebc79dcc | ||
|
|
ff0de5f0d5 | ||
|
|
7dc6410dd1 | ||
|
|
05a5147f88 | ||
|
|
95457fb756 | ||
|
|
ec58262184 | ||
|
|
f13c59e009 | ||
|
|
33b61760e7 | ||
|
|
b244b0bf8c | ||
|
|
aa19772a73 | ||
|
|
b52aba91ca | ||
|
|
64f83ea65b | ||
|
|
a40ae34312 | ||
|
|
de262a3469 | ||
|
|
3733e2ae15 | ||
|
|
2d62f273a3 | ||
|
|
2b77d4d847 | ||
|
|
5ad02c5a85 | ||
|
|
8b6b552e71 | ||
|
|
b4f2a14d82 | ||
|
|
e4a0d7edb0 | ||
|
|
e943e5ea2c | ||
|
|
dde287c9c8 | ||
|
|
8285ae0f1a | ||
|
|
52ece6559f | ||
|
|
75a3b6af6e | ||
|
|
f995dd1309 | ||
|
|
c9444823b4 | ||
|
|
a52c519313 | ||
|
|
08e31f8822 |
@@ -11,9 +11,7 @@ can be found on the [releases page](https://github.com/JetBrains/JetBrainsRuntim
|
||||
|
||||
| IDE Version | Latest JBR | Date Released |
|
||||
| --- | --- | --- |
|
||||
| 2022.3 | [17.0.4.1-b597.1](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr-release-17.0.4.1b597.1)| 12-Sep-2022 |
|
||||
| 2022.2 | [17.0.4-b469.53](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr-release-17.0.4b469.53)| 31-Aug-2022 |
|
||||
|
||||
| 2022.2 | [17.0.3-b463.3](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr17.0.3b463.3) | 24-May-2022 |
|
||||
|
||||
## Contents
|
||||
- [Welcome to JetBrains Runtime](#jetbrains-runtime)
|
||||
|
||||
@@ -114,8 +114,8 @@ cd "$SCRIPT_DIR/.." ; OPENJDK_DIR=`pwd`
|
||||
IDEA_MAKE="$OPENJDK_DIR/make/ide/idea/jdk"
|
||||
IDEA_TEMPLATE="$IDEA_MAKE/template"
|
||||
|
||||
cp -r "$TOPLEVEL_DIR/jb/project/idea-project-files"/* "$IDEA_OUTPUT"
|
||||
cp -r "$IDEA_TEMPLATE"/* "$IDEA_OUTPUT"
|
||||
cp -rn "$TOPLEVEL_DIR/jb/project/idea-project-files"/* "$IDEA_OUTPUT"
|
||||
cp -rn "$IDEA_TEMPLATE"/* "$IDEA_OUTPUT"
|
||||
|
||||
#override template
|
||||
if [ -d "$TEMPLATES_OVERRIDE" ] ; then
|
||||
@@ -321,4 +321,4 @@ if [ "$VERBOSE" = true ] ; then
|
||||
echo "
|
||||
Now you can open \"$IDEA_PROJECT_DIR\" as IDEA project
|
||||
You can also run 'bash \"$IDEA_OUTPUT/jdk-clion/update-project.sh\"' to generate Clion project"
|
||||
fi
|
||||
fi
|
||||
@@ -100,18 +100,11 @@ REPRODUCIBLE_BUILD_OPTS="--enable-reproducible-build
|
||||
|
||||
function zip_native_debug_symbols() {
|
||||
image_bundle_path=$(echo $1 | cut -d"/" -f-4)
|
||||
jdk_name=$(echo $1 | cut -d"/" -f5)
|
||||
jbr_diz_name=$2
|
||||
|
||||
[ -d "dizfiles" ] && rm -rf dizfiles
|
||||
mkdir dizfiles
|
||||
(cd $image_bundle_path && find . -name '*.diz' -exec rsync -R {} ../../../../dizfiles \; )
|
||||
|
||||
rsync_target="../../../../dizfiles"
|
||||
[ -z "$jdk_name" ] && rsync_target=$rsync_target"/"$jbr_diz_name
|
||||
(cd $image_bundle_path && find . -name '*.diz' -exec rsync -R {} $rsync_target \;)
|
||||
[ ! -z "$jdk_name" ] && mv dizfiles/$jdk_name dizfiles/$jbr_diz_name
|
||||
|
||||
(cd dizfiles && find $jbr_diz_name -print0 | COPYFILE_DISABLE=1 \
|
||||
(cd dizfiles && find . -print0 | COPYFILE_DISABLE=1 \
|
||||
tar --no-recursion --null -T - -czf ../"$jbr_diz_name".tar.gz) || do_exit $?
|
||||
}
|
||||
|
||||
@@ -146,7 +139,7 @@ function update_jsdk_mods() {
|
||||
# re-create java.base.jmod with updated hashes
|
||||
tmp=.java.base.$$.tmp
|
||||
mkdir "$tmp" || exit $?
|
||||
hash_modules=$("$__jsdk"/bin/jmod describe "$__orig_jsdk_mods"/java.base.jmod | grep hashes | awk '{print $2}' | tr '\n' '|' | sed s/\|$//) || exit $?
|
||||
hash_modules=$("$JSDK"/bin/jmod describe "$__orig_jsdk_mods"/java.base.jmod | grep hashes | awk '{print $2}' | tr '\n' '|' | sed s/\|$//) || exit $?
|
||||
"$__jsdk"/bin/jmod extract --dir "$tmp" "$__orig_jsdk_mods"/java.base.jmod || exit $?
|
||||
rm "$__updated_jsdk_mods"/java.base.jmod || exit $? # temp exclude from path
|
||||
"$__jsdk"/bin/jmod \
|
||||
|
||||
@@ -63,7 +63,7 @@ function create_image_bundle {
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-linux-${libc_type_suffix}aarch64-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-linux-${libc_type_suffix}aarch64-${fastdebug_infix:-}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-${libc_type_suffix}aarch64-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
|
||||
echo Running jlink....
|
||||
|
||||
@@ -63,7 +63,7 @@ function create_image_bundle {
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-linux-${libc_type_suffix}x64-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-linux-${libc_type_suffix}x64-${fastdebug_infix:-}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-${libc_type_suffix}x64-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Running jlink....
|
||||
[ -d "$IMAGES_DIR"/"$__root_dir" ] && rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
|
||||
@@ -93,7 +93,7 @@ function create_image_bundle {
|
||||
[ -f "$JBR".tar.gz ] && rm "$JBR.tar.gz"
|
||||
touch -c -d "@$SOURCE_DATE_EPOCH" "$JBR".tar
|
||||
gzip "$JBR".tar || do_exit $?
|
||||
#rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
|
||||
rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
|
||||
}
|
||||
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=release"
|
||||
|
||||
@@ -52,7 +52,7 @@ function create_image_bundle {
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-linux-${libc_type_suffix}x86-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-linux-${libc_type_suffix}x86-${fastdebug_infix:-}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-${libc_type_suffix}x86-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Running jlink....
|
||||
[ -d "$IMAGES_DIR"/"$__root_dir" ] && rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
|
||||
|
||||
@@ -29,14 +29,6 @@ BOOT_JDK=${BOOT_JDK:=$(/usr/libexec/java_home -v 16)}
|
||||
|
||||
function do_configure {
|
||||
if [[ "${architecture}" == *aarch64* ]]; then
|
||||
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
|
||||
WITH_EXTRA_CFLAGS="--with-extra-cflags="-F$(pwd)/$JCEF_PATH/Frameworks"
|
||||
--with-extra-cxxflags="-F$(pwd)/$JCEF_PATH/Frameworks"
|
||||
--with-extra-ldflags="-F$(pwd)/$JCEF_PATH/Frameworks" "
|
||||
else
|
||||
WITH_EXTRA_CFLAGS=""
|
||||
fi
|
||||
sh configure \
|
||||
$WITH_DEBUG_LEVEL \
|
||||
--with-vendor-name="${VENDOR_NAME}" \
|
||||
@@ -51,7 +43,9 @@ function do_configure {
|
||||
--with-macosx-version-max="${MACOSX_VERSION_MAX:="11.00.00"}" \
|
||||
--disable-hotspot-gtest --disable-javac-server --disable-full-docs --disable-manpages \
|
||||
--enable-cds=no \
|
||||
$WITH_EXTRA_CFLAGS \
|
||||
--with-extra-cflags="-F$(pwd)/Frameworks" \
|
||||
--with-extra-cxxflags="-F$(pwd)/Frameworks" \
|
||||
--with-extra-ldflags="-F$(pwd)/Frameworks" \
|
||||
$STATIC_CONF_ARGS \
|
||||
$REPRODUCIBLE_BUILD_OPTS \
|
||||
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|
||||
@@ -90,7 +84,7 @@ function create_image_bundle {
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-osx-${architecture}-${fastdebug_infix:-}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-osx-${architecture}-${fastdebug_infix:-}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-${architecture}-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
JRE_CONTENTS=$tmp/$__root_dir/Contents
|
||||
mkdir -p "$JRE_CONTENTS" || do_exit $?
|
||||
|
||||
@@ -2,27 +2,20 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
TC_PRINT=0
|
||||
# Always print TeamCity service messages if running under TeamCity
|
||||
[[ -n "${TEAMCITY_VERSION:-}" ]] && TC_PRINT=1
|
||||
|
||||
while getopts ":t" o; do
|
||||
case "${o}" in
|
||||
t) TC_PRINT=1 ;;
|
||||
*);;
|
||||
t)
|
||||
t="With Teamcity tests info"
|
||||
TC_PRINT=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
NEWFILEPATH="$1"
|
||||
CONFIGID="$2"
|
||||
BUILDID="$3"
|
||||
TOKEN="$4"
|
||||
|
||||
if [ ! -f "$NEWFILEPATH" ]; then
|
||||
echo "File not found: $NEWFILEPATH"
|
||||
exit 1
|
||||
fi
|
||||
NEWFILEPATH=$1
|
||||
CONFIGID=$2
|
||||
BUILDID=$3
|
||||
TOKEN=$4
|
||||
#
|
||||
# Get the size of new artifact
|
||||
#
|
||||
@@ -36,7 +29,11 @@ case "${unameOut}" in
|
||||
NEWFILESIZE=$(stat -f%z "$NEWFILEPATH")
|
||||
;;
|
||||
CYGWIN*)
|
||||
NEWFILESIZE=$(stat -c%s "$NEWFILEPATH")
|
||||
NEWFILESIZE=$(stat -c%s$4
|
||||
#
|
||||
# Get the size of new artifact
|
||||
#
|
||||
"$NEWFILEPATH")
|
||||
;;
|
||||
MINGW*)
|
||||
NEWFILESIZE=$(stat -c%s "$NEWFILEPATH")
|
||||
@@ -45,13 +42,13 @@ case "${unameOut}" in
|
||||
echo "Unknown machine: ${unameOut}"
|
||||
exit 1
|
||||
esac
|
||||
FILENAME=$(basename "${NEWFILEPATH}")
|
||||
FILENAME=$(basename ${NEWFILEPATH})
|
||||
|
||||
#
|
||||
# Get pattern of artifact name
|
||||
# Base filename pattern: <BUNDLE_TYPE>-<JDK_VERSION>-<OS>-<ARCH>-b<BUILD>.tar.gz: jbr_dcevm-17.0.2-osx-x64-b1234.tar.gz
|
||||
# BUNDLE_TYPE: jbr, jbrsdk, jbr_dcevm, jbrsdk_jcef etc.
|
||||
# OS_ARCH_PATTERN - <os_architecture>: osx-x64, linux-aarch64, linux-musl-x64, windows-x64 etc.
|
||||
# OS_ARCH_PATTERN - <os_architecture>: osx-x64, linux-aarch64, windows-x64 etc.
|
||||
|
||||
BUNDLE_TYPE=jbrsdk
|
||||
OS_ARCH_PATTERN=""
|
||||
@@ -62,37 +59,33 @@ if [[ $FILENAME =~ $re ]]; then
|
||||
BUNDLE_TYPE=${BASH_REMATCH[1]}
|
||||
OS_ARCH_PATTERN=${BASH_REMATCH[2]}
|
||||
FILE_EXTENSION=${BASH_REMATCH[3]}
|
||||
else
|
||||
echo "File name $FILENAME does not match regex $re"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function test_started_msg() {
|
||||
if [ $TC_PRINT -eq 1 ]; then
|
||||
echo "##teamcity[testStarted name='$1']"
|
||||
fi
|
||||
}
|
||||
if [ $TC_PRINT -eq 1 ]; then
|
||||
testname_file_ext=`echo $FILE_EXTENSION | sed 's/\./_/g'`
|
||||
testname=$BUNDLE_TYPE"_"$OS_ARCH_PATTERN$testname_file_ext
|
||||
echo \#\#teamcity[testStarted name=\'$testname\']
|
||||
fi
|
||||
|
||||
|
||||
echo "BUNDLE_TYPE: " $BUNDLE_TYPE
|
||||
echo "OS_ARCH_PATTERN: " $OS_ARCH_PATTERN
|
||||
echo "FILE_EXTENSION: " $FILE_EXTENSION
|
||||
echo "New size of $FILENAME = $NEWFILESIZE bytes."
|
||||
|
||||
|
||||
function test_failed_msg() {
|
||||
if [ $TC_PRINT -eq 1 ]; then
|
||||
echo "##teamcity[testFailed name='$1' message='$2']"
|
||||
if [ $3 -eq 1 ]; then
|
||||
echo \#\#teamcity[testFailed name=\'$1\' message=\'$2\']
|
||||
fi
|
||||
}
|
||||
|
||||
function test_finished_msg() {
|
||||
if [ $TC_PRINT -eq 1 ]; then
|
||||
echo "##teamcity[testFinished name='$1']"
|
||||
if [ $2 -eq 1 ]; then
|
||||
echo \#\#teamcity[testFinished name=\'$1\']
|
||||
fi
|
||||
}
|
||||
|
||||
test_name="${BUNDLE_TYPE}_${OS_ARCH_PATTERN//\-/_}${FILE_EXTENSION//\./_}"
|
||||
test_started_msg "$test_name"
|
||||
|
||||
echo "BUNDLE_TYPE: $BUNDLE_TYPE"
|
||||
echo "OS_ARCH_PATTERN: $OS_ARCH_PATTERN"
|
||||
echo "FILE_EXTENSION: $FILE_EXTENSION"
|
||||
echo "Size of $FILENAME is $NEWFILESIZE bytes"
|
||||
|
||||
#
|
||||
# Get previous successful build ID
|
||||
# Example:
|
||||
@@ -102,21 +95,20 @@ echo "Size of $FILENAME is $NEWFILESIZE bytes"
|
||||
# expected return value
|
||||
# id="123".number="567"
|
||||
#
|
||||
CURL_RESPONSE=$(curl -sSL --header "Authorization: Bearer $TOKEN" "https://buildserver.labs.intellij.net/app/rest/builds/?locator=buildType:(id:$CONFIGID),status:success,count:1,finishDate:(build:$BUILDID,condition:before)")
|
||||
CURL_RESPONSE=$(curl --header "Authorization: Bearer $TOKEN" "https://buildserver.labs.intellij.net/app/rest/builds/?locator=buildType:(id:$CONFIGID),status:success,count:1,finishDate:(build:$BUILDID,condition:before)")
|
||||
re='id=\"([0-9]+)\".+number=\"([0-9\.]+)\"'
|
||||
|
||||
# ID: Previous successful build id
|
||||
ID=0
|
||||
if [[ $CURL_RESPONSE =~ $re ]]; then
|
||||
ID=${BASH_REMATCH[1]}
|
||||
echo "Previous build ID: $ID"
|
||||
echo "Previous build number: ${BASH_REMATCH[2]}"
|
||||
echo "BUILD Number: ${BASH_REMATCH[2]}"
|
||||
else
|
||||
msg="ERROR: cannot find previous build"
|
||||
echo "$msg"
|
||||
echo "$CURL_RESPONSE"
|
||||
test_failed_msg "$test_name" "$msg"
|
||||
test_finished_msg "$test_name"
|
||||
msg="ERROR: can't find previous build"
|
||||
echo $msg
|
||||
echo $CURL_RESPONSE
|
||||
test_failed_msg $testname $msg $TC_PRINT
|
||||
test_finished_msg $testname $TC_PRINT
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -126,37 +118,36 @@ fi
|
||||
# expected return value
|
||||
# name="jbrsdk_jcef*.tar.gz size="123'
|
||||
#
|
||||
CURL_RESPONSE=$(curl -sSL --header "Authorization: Bearer $TOKEN" "https://buildserver.labs.intellij.net/app/rest/builds/$ID?fields=id,number,artifacts(file(name,size))")
|
||||
echo "Artifacts of the previous build:"
|
||||
echo "$CURL_RESPONSE"
|
||||
CURL_RESPONSE=$(curl --header "Authorization: Bearer $TOKEN" "https://buildserver.labs.intellij.net/app/rest/builds/$ID?fields=id,number,artifacts(file(name,size))")
|
||||
echo "Atrifacts of previous build of $CONFIGID :"
|
||||
echo $CURL_RESPONSE
|
||||
|
||||
# Find binary size (in response) with reg exp
|
||||
re="name=\"(${BUNDLE_TYPE}[^\"]+${OS_ARCH_PATTERN}[^\"]+${FILE_EXTENSION})\" size=\"([0-9]+)\""
|
||||
re='name=\"('$BUNDLE_TYPE'[^\"]+'${OS_ARCH_PATTERN}'[^\"]+'${FILE_EXTENSION}')\" size=\"([0-9]+)\"'
|
||||
|
||||
if [[ $CURL_RESPONSE =~ $re ]]; then
|
||||
prevFileName=${BASH_REMATCH[1]}
|
||||
echo "Previous artifact name: $prevFileName"
|
||||
prevFileSize=${BASH_REMATCH[2]}
|
||||
echo "Previous artifact size: $prevFileSize"
|
||||
OLDFILENAME=${BASH_REMATCH[1]}
|
||||
echo "Prev artifact name: $OLDFILENAME"
|
||||
OLDFILESIZE=${BASH_REMATCH[2]}
|
||||
echo "Prev artifact size = $OLDFILESIZE"
|
||||
|
||||
((allowedSize=prevFileSize+prevFileSize/20)) # use 5% threshold
|
||||
echo "Allowed size: $allowedSize"
|
||||
let allowedSize=OLDFILESIZE+OLDFILESIZE/20 # use 5% threshold
|
||||
echo "Allowed size = $allowedSize"
|
||||
if [[ "$NEWFILESIZE" -gt "$allowedSize" ]]; then
|
||||
msg="ERROR: new size is significantly greater than previous size (need to investigate)"
|
||||
echo "$msg"
|
||||
test_failed_msg "$test_name" "$msg"
|
||||
test_finished_msg "$test_name"
|
||||
msg="ERROR: new size is significally greater than prev size (need to investigate)"
|
||||
echo $msg
|
||||
test_failed_msg $testname $msg $TC_PRINT
|
||||
test_finished_msg $testname $TC_PRINT
|
||||
exit 1
|
||||
else
|
||||
echo "PASSED"
|
||||
test_finished_msg "$test_name"
|
||||
test_finished_msg $testname $TC_PRINT
|
||||
fi
|
||||
else
|
||||
msg="ERROR: cannot find string with size in xml response:"
|
||||
echo "Regex: $re"
|
||||
echo "$msg"
|
||||
echo "$CURL_RESPONSE"
|
||||
test_failed_msg "$test_name" "$msg"
|
||||
test_finished_msg "$test_name"
|
||||
msg="ERROR: can't find string with size in xml response:"
|
||||
echo $msg
|
||||
echo $CURL_RESPONSE
|
||||
test_failed_msg $testname $msg $TC_PRINT
|
||||
test_finished_msg $testname $TC_PRINT
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -60,13 +60,7 @@ else
|
||||
testContent=`paste -d '\t' $refFile <(echo "$curValues") | tail -n +1`
|
||||
fi
|
||||
|
||||
testContent=`echo "$testContent" | tr "," "." | awk -F'\t' '{
|
||||
if ($3>$2+$2*0.1) {
|
||||
print "* "$1"\t"$2"\t"$3"\t"(($2>0)?$3/$2:"-")
|
||||
} else {
|
||||
print " "$1"\t"$2"\t"$3"\t"(($2>0)?$3/$2:"-")
|
||||
}
|
||||
}'`
|
||||
testContent=`echo "$testContent" | awk -F'\t' '{ if ($3>$2+$2*0.1) {print "* "$1"\t"$2"\t"$3"\t"(($2==0)?"-":$3/$2)} else {print " "$1"\t"$2"\t"$3"\t"(($2==0)?"-":$3/$2)} }'`
|
||||
if [ -z $noHeaders ]; then
|
||||
echo "$header" > $resFile
|
||||
fi
|
||||
@@ -77,12 +71,12 @@ if [ -z $tc ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
failed=0
|
||||
failed=1
|
||||
echo "$testContent" 2>&1 | (
|
||||
while read -r s; do
|
||||
testname=`echo "$s" | cut -f 1 | tr -d "[:space:]" | tr -d "*"`
|
||||
duration=`echo "$s" | cut -f 3`
|
||||
echo "$s" | cut -c1 | grep -c "*" && failed=1
|
||||
echo "$s" | cut -c1 | grep -c "*" && failed=0
|
||||
echo \#\#teamcity[testStarted name=\'$testNamePrefix$testname\']
|
||||
echo "===>$s"
|
||||
echo \#\#teamcity[buildStatisticValue key=\'$testNamePrefix$testname\' value=\'$duration\']
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built;possible values:
|
||||
# <empty> or nomod - the release bundles without any additional modules (jcef)
|
||||
# jcef - the release bundles with jcef
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
#
|
||||
# This script makes test-image along with JDK images when bundle_type is set to "jcef".
|
||||
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
|
||||
#
|
||||
# Environment variables:
|
||||
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument
|
||||
# to configure
|
||||
# By default JDK_BUILD_NUMBER is set zero
|
||||
# JCEF_PATH - specifies the path to the directory with JCEF binaries.
|
||||
# By default JCEF binaries should be located in ./jcef_win_aarch64
|
||||
|
||||
if [ -z "$BUILD_JDK" ]; then
|
||||
echo "BUILD_JDK environment variable must be specified and point to a JDK built from the current sources" \
|
||||
" and is able to run on the build system. See OpenJDK documentation for --with-build-jdk for more info."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
WORK_DIR=$(pwd)
|
||||
JCEF_PATH=${JCEF_PATH:=$WORK_DIR/jcef_win_aarch64}
|
||||
|
||||
function do_configure {
|
||||
sh ./configure \
|
||||
--enable-option-checking=fatal \
|
||||
--openjdk-target=aarch64-unknown-cygwin \
|
||||
$WITH_DEBUG_LEVEL \
|
||||
--with-vendor-name="$VENDOR_NAME" \
|
||||
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
|
||||
--with-jvm-features=shenandoahgc \
|
||||
--with-version-pre= \
|
||||
--with-version-build=$JDK_BUILD_NUMBER \
|
||||
--with-version-opt=b${build_number} \
|
||||
--with-toolchain-version=$TOOLCHAIN_VERSION \
|
||||
--with-boot-jdk=$BOOT_JDK \
|
||||
--with-build-jdk=$BUILD_JDK \
|
||||
--disable-ccache \
|
||||
--enable-cds=yes \
|
||||
$STATIC_CONF_ARGS \
|
||||
$REPRODUCIBLE_BUILD_OPTS \
|
||||
|| do_exit $?
|
||||
}
|
||||
|
||||
function create_image_bundle {
|
||||
__bundle_name=$1
|
||||
__arch_name=$2
|
||||
__modules_path=$3
|
||||
__modules=$4
|
||||
|
||||
fastdebug_infix=''
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-windows-aarch64-${fastdebug_infix}b${build_number}
|
||||
|
||||
echo Running jlink ...
|
||||
${BUILD_JDK}/bin/jlink \
|
||||
--module-path $__modules_path --no-man-pages --compress=2 \
|
||||
--add-modules $__modules --output $__root_dir || do_exit $?
|
||||
|
||||
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> $__root_dir/release
|
||||
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
|
||||
sed 's/JBR/JBRSDK/g' $__root_dir/release > release
|
||||
mv release $__root_dir/release
|
||||
for dir in $(ls -d $IMAGES_DIR/jdk/*); do
|
||||
rsync -a --exclude demo --exclude sample $dir $__root_dir
|
||||
done
|
||||
copy_jmods "$__modules" "$__modules_path" "$__root_dir"/jmods
|
||||
fi
|
||||
}
|
||||
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=release"
|
||||
RELEASE_NAME=windows-aarch64-server-release
|
||||
|
||||
case "$bundle_type" in
|
||||
"jcef")
|
||||
do_reset_changes=0
|
||||
do_maketest=1
|
||||
;;
|
||||
"nomod" | "")
|
||||
bundle_type=""
|
||||
;;
|
||||
"fd")
|
||||
do_reset_changes=0
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
|
||||
RELEASE_NAME=windows-aarch64-server-fastdebug
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "${INC_BUILD:-}" ]; then
|
||||
do_configure || do_exit $?
|
||||
if [ $do_maketest -eq 1 ]; then
|
||||
make LOG=info CONF=$RELEASE_NAME clean images test-image || do_exit $?
|
||||
else
|
||||
make LOG=info CONF=$RELEASE_NAME clean images || do_exit $?
|
||||
fi
|
||||
else
|
||||
if [ $do_maketest -eq 1 ]; then
|
||||
make LOG=info CONF=$RELEASE_NAME images test-image || do_exit $?
|
||||
else
|
||||
make LOG=info CONF=$RELEASE_NAME images || do_exit $?
|
||||
fi
|
||||
fi
|
||||
|
||||
IMAGES_DIR=build/$RELEASE_NAME/images
|
||||
JSDK=$IMAGES_DIR/jdk
|
||||
JSDK_MODS_DIR=$IMAGES_DIR/jmods
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
|
||||
git apply -p0 < jb/project/tools/patches/add_jcef_module_aarch64.patch || do_exit $?
|
||||
update_jsdk_mods "$BUILD_JDK" "$JCEF_PATH"/jmods "$JSDK"/jmods "$JSDK_MODS_DIR" || do_exit $?
|
||||
cp $JCEF_PATH/jmods/* ${JSDK_MODS_DIR} # $JSDK/jmods is not unchanged
|
||||
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
else
|
||||
jbr_name_postfix=""
|
||||
fi
|
||||
|
||||
# create runtime image bundle
|
||||
modules=$(xargs < jb/project/tools/common/modules.list | sed s/" "//g) || do_exit $?
|
||||
modules+=",jdk.crypto.mscapi"
|
||||
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
|
||||
|
||||
# create sdk image bundle
|
||||
modules=$(cat ${JSDK}/release | grep MODULES | sed s/MODULES=//g | sed s/' '/','/g | sed s/\"//g | sed s/\\r//g | sed s/\\n//g) || do_exit $?
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
|
||||
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
|
||||
fi
|
||||
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" "$JBRSDK_BUNDLE" "$JSDK_MODS_DIR" "$modules" || do_exit $?
|
||||
|
||||
do_exit 0
|
||||
@@ -52,7 +52,7 @@ function create_image_bundle {
|
||||
fastdebug_infix=''
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-windows-x64-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-x64-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Running jlink ...
|
||||
${JSDK}/bin/jlink \
|
||||
|
||||
@@ -47,7 +47,7 @@ function create_image_bundle {
|
||||
fastdebug_infix=''
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-windows-x86-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-x86-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Running jlink ...
|
||||
${JSDK}/bin/jlink \
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built;possible values:
|
||||
# <empty> or nomod - the release bundles without any additional modules (jcef)
|
||||
# jcef - the release bundles with jcef
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
#
|
||||
# This script packs test-image along with JDK images when bundle_type is set to "jcef".
|
||||
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
|
||||
#
|
||||
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
[ "$bundle_type" == "jcef" ] && do_maketest=1
|
||||
|
||||
function pack_jbr {
|
||||
__bundle_name=$1
|
||||
__arch_name=$2
|
||||
|
||||
fastdebug_infix=''
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-windows-aarch64-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-windows-aarch64-${fastdebug_infix}b${build_number}
|
||||
|
||||
echo Creating $JBR.tar.gz ...
|
||||
chmod -R ug+rwx,o+rx ${BASE_DIR}/$__root_dir
|
||||
/usr/bin/tar -czf $JBR.tar.gz -C $BASE_DIR $__root_dir || do_exit $?
|
||||
}
|
||||
|
||||
[ "$bundle_type" == "nomod" ] && bundle_type=""
|
||||
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
RELEASE_NAME=windows-aarch64-server-release
|
||||
IMAGES_DIR=build/$RELEASE_NAME/images
|
||||
BASE_DIR=.
|
||||
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ]; then
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
else
|
||||
jbr_name_postfix=""
|
||||
fi
|
||||
|
||||
pack_jbr jbr${jbr_name_postfix} jbr
|
||||
pack_jbr jbrsdk${jbr_name_postfix} jbrsdk
|
||||
|
||||
if [ $do_maketest -eq 1 ]; then
|
||||
JBRSDK_TEST=$JBRSDK_BUNDLE-$JBSDK_VERSION-windows-test-aarch64-b$build_number
|
||||
echo Creating $JBRSDK_TEST.tar.gz ...
|
||||
/usr/bin/tar -czf $JBRSDK_TEST.tar.gz -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
|
||||
fi
|
||||
@@ -26,7 +26,7 @@ function pack_jbr {
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-windows-x64-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-windows-x64-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-x64-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Creating $JBR.tar.gz ...
|
||||
chmod -R ug+rwx,o+rx ${BASE_DIR}/$__root_dir
|
||||
|
||||
@@ -22,7 +22,7 @@ function pack_jbr {
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-windows-x86-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-windows-x86-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-x86-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Creating $JBR.tar.gz ...
|
||||
chmod -R ug+rwx,o+rx ${BASE_DIR}/$__root_dir
|
||||
|
||||
@@ -229,19 +229,15 @@ else
|
||||
endif
|
||||
|
||||
ifeq ($(ENABLE_REPRODUCIBLE_BUILD), true)
|
||||
# If boot JDK's jar supported --date, jrt-fs.jar would've been built with
|
||||
# that option already.
|
||||
ifneq ($(BOOT_JDK_JAR_SUPPORTS_DATE), true)
|
||||
ifeq ($(MODULE), java.base)
|
||||
JAR_FILE_TO_FIX := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jrt-fs.jar
|
||||
$(eval $(call SetupExecute, fixup_jrtfs_jar, \
|
||||
WARN := Fixing timestamps in modules_libs/java.base/jrt-fs.jar, \
|
||||
DEPS := $(JAR_FILE_TO_FIX) $(JDK_OUTPUTDIR)/bin/jar, \
|
||||
OUTPUT_DIR := $(JMODS_SUPPORT_DIR), \
|
||||
COMMAND := $(BUILD_JAR) --date $(SOURCE_DATE_ISO_8601) --update --file $(JAR_FILE_TO_FIX) @$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/_the.jrt-fs.jar_contents, \
|
||||
))
|
||||
DEPS += $(fixup_jrtfs_jar_TARGET)
|
||||
endif
|
||||
ifeq ($(MODULE), java.base)
|
||||
JAR_FILE_TO_FIX := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jrt-fs.jar
|
||||
$(eval $(call SetupExecute, fixup_jrtfs_jar, \
|
||||
WARN := Fixing timestamps in modules_libs/java.base/jrt-fs.jar, \
|
||||
DEPS := $(JAR_FILE_TO_FIX) $(JDK_OUTPUTDIR)/bin/jar, \
|
||||
OUTPUT_DIR := $(JMODS_SUPPORT_DIR), \
|
||||
COMMAND := $(FIXPATH) $(JDK_OUTPUTDIR)/bin/jar --date $(SOURCE_DATE_ISO_8601) --update --file $(JAR_FILE_TO_FIX) @$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/_the.jrt-fs.jar_contents, \
|
||||
))
|
||||
DEPS += $(fixup_jrtfs_jar_TARGET)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -116,18 +116,6 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
|
||||
CFLAGS_DEBUG_SYMBOLS="-g"
|
||||
ASFLAGS_DEBUG_SYMBOLS="-g"
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
|
||||
# Check if compiler supports -fdebug-prefix-map. If so, use that to make
|
||||
# the debug symbol paths resolve to paths relative to the workspace root.
|
||||
workspace_root_trailing_slash="${WORKSPACE_ROOT%/}/"
|
||||
DEBUG_PREFIX_CFLAGS="-fdebug-prefix-map=${workspace_root_trailing_slash}="
|
||||
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${DEBUG_PREFIX_CFLAGS}],
|
||||
IF_FALSE: [
|
||||
DEBUG_PREFIX_CFLAGS=
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
CFLAGS_DEBUG_SYMBOLS="-g"
|
||||
ASFLAGS_DEBUG_SYMBOLS="-g"
|
||||
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
|
||||
|
||||
@@ -359,9 +359,9 @@ define SetupCompileNativeFileBody
|
||||
$1_FLAGS := $(BASIC_ASFLAGS) $$($1_BASE_ASFLAGS)
|
||||
$1_COMPILER := $(AS)
|
||||
|
||||
# gcc or clang assembly files must contain an appropriate relative .file
|
||||
# gcc assembly files must contain an appropriate relative .file
|
||||
# path for reproducible builds.
|
||||
ifneq ($(findstring $(TOOLCHAIN_TYPE), gcc clang), )
|
||||
ifeq ($(TOOLCHAIN_TYPE), gcc)
|
||||
# If no absolute paths allowed, work out relative source file path
|
||||
# for assembly .file substitution, otherwise use full file path
|
||||
ifeq ($(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT), false)
|
||||
@@ -403,9 +403,8 @@ define SetupCompileNativeFileBody
|
||||
$1_OBJ_DEPS := $$($1_SRC_FILE) $$($$($1_BASE)_COMPILE_VARDEPS_FILE) \
|
||||
$$($$($1_BASE)_EXTRA_DEPS) $$($1_VARDEPS_FILE)
|
||||
$1_COMPILE_OPTIONS := $$($1_FLAGS) $(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE)
|
||||
# For reproducible builds with gcc and clang ensure random symbol generation is
|
||||
# seeded deterministically
|
||||
ifneq ($(findstring $(TOOLCHAIN_TYPE), gcc clang), )
|
||||
# For reproducible builds with gcc ensure random symbol generation is seeded deterministically
|
||||
ifeq ($(TOOLCHAIN_TYPE), gcc)
|
||||
ifeq ($$(ENABLE_REPRODUCIBLE_BUILD), true)
|
||||
$1_COMPILE_OPTIONS += -frandom-seed="$$($1_FILENAME)"
|
||||
endif
|
||||
|
||||
@@ -198,58 +198,58 @@ dialoginput.bolditalic.korean=Malgun Gothic
|
||||
|
||||
# Search Sequences
|
||||
|
||||
sequence.allfonts=alphabetic/default,dingbats,symbol,symbols
|
||||
sequence.allfonts=alphabetic/default
|
||||
|
||||
sequence.serif.GBK=alphabetic,chinese-ms936,dingbats,symbol,chinese-ms936-extb,symbols
|
||||
sequence.sansserif.GBK=alphabetic,chinese-ms936,dingbats,symbol,chinese-ms936-extb,symbols
|
||||
sequence.monospaced.GBK=chinese-ms936,alphabetic,dingbats,symbol,chinese-ms936-extb,symbols
|
||||
sequence.dialog.GBK=alphabetic,chinese-ms936,dingbats,symbol,chinese-ms936-extb,symbols
|
||||
sequence.dialoginput.GBK=alphabetic,chinese-ms936,dingbats,symbol,chinese-ms936-extb,symbols
|
||||
sequence.serif.GBK=alphabetic,chinese-ms936,chinese-ms936-extb
|
||||
sequence.sansserif.GBK=alphabetic,chinese-ms936,chinese-ms936-extb
|
||||
sequence.monospaced.GBK=chinese-ms936,alphabetic,chinese-ms936-extb
|
||||
sequence.dialog.GBK=alphabetic,chinese-ms936,chinese-ms936-extb
|
||||
sequence.dialoginput.GBK=alphabetic,chinese-ms936,chinese-ms936-extb
|
||||
|
||||
sequence.serif.GB18030=alphabetic,chinese-gb18030,dingbats,symbol,chinese-gb18030-extb,symbols
|
||||
sequence.sansserif.GB18030=alphabetic,chinese-gb18030,dingbats,symbol,chinese-gb18030-extb,symbols
|
||||
sequence.monospaced.GB18030=chinese-gb18030,alphabetic,dingbats,symbol,chinese-gb18030-extb,symbols
|
||||
sequence.dialog.GB18030=alphabetic,chinese-gb18030,dingbats,symbol,chinese-gb18030-extb,symbols
|
||||
sequence.dialoginput.GB18030=alphabetic,chinese-gb18030,dingbats,symbol,chinese-gb18030-extb,symbols
|
||||
sequence.serif.GB18030=alphabetic,chinese-gb18030,chinese-gb18030-extb
|
||||
sequence.sansserif.GB18030=alphabetic,chinese-gb18030,chinese-gb18030-extb
|
||||
sequence.monospaced.GB18030=chinese-gb18030,alphabetic,chinese-gb18030-extb
|
||||
sequence.dialog.GB18030=alphabetic,chinese-gb18030,chinese-gb18030-extb
|
||||
sequence.dialoginput.GB18030=alphabetic,chinese-gb18030,chinese-gb18030-extb
|
||||
|
||||
sequence.serif.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.sansserif.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.monospaced.x-windows-950=chinese-ms950,alphabetic,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.dialog.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.dialoginput.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.serif.x-windows-950=alphabetic,chinese-ms950,chinese-ms950-extb
|
||||
sequence.sansserif.x-windows-950=alphabetic,chinese-ms950,chinese-ms950-extb
|
||||
sequence.monospaced.x-windows-950=chinese-ms950,alphabetic,chinese-ms950-extb
|
||||
sequence.dialog.x-windows-950=alphabetic,chinese-ms950,chinese-ms950-extb
|
||||
sequence.dialoginput.x-windows-950=alphabetic,chinese-ms950,chinese-ms950-extb
|
||||
|
||||
sequence.serif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.sansserif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.monospaced.x-MS950-HKSCS=chinese-ms950,alphabetic,chinese-hkscs,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.dialog.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.dialoginput.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.serif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,chinese-ms950-extb
|
||||
sequence.sansserif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,chinese-ms950-extb
|
||||
sequence.monospaced.x-MS950-HKSCS=chinese-ms950,alphabetic,chinese-hkscs,chinese-ms950-extb
|
||||
sequence.dialog.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,chinese-ms950-extb
|
||||
sequence.dialoginput.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,chinese-ms950-extb
|
||||
|
||||
sequence.serif.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.sansserif.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.monospaced.x-MS950-HKSCS-XP=chinese-ms950,alphabetic,chinese-hkscs,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.dialog.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.dialoginput.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb,symbols
|
||||
sequence.serif.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,chinese-ms950-extb
|
||||
sequence.sansserif.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,chinese-ms950-extb
|
||||
sequence.monospaced.x-MS950-HKSCS-XP=chinese-ms950,alphabetic,chinese-hkscs,chinese-ms950-extb
|
||||
sequence.dialog.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,chinese-ms950-extb
|
||||
sequence.dialoginput.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,chinese-ms950-extb
|
||||
|
||||
sequence.allfonts.UTF-8.hi=alphabetic/1252,devanagari,dingbats,symbol,symbols
|
||||
sequence.allfonts.UTF-8.ja=alphabetic,japanese,devanagari,dingbats,symbol,symbols
|
||||
sequence.allfonts.UTF-8.hi=alphabetic/1252,devanagari
|
||||
sequence.allfonts.UTF-8.ja=alphabetic,japanese,devanagari
|
||||
|
||||
sequence.allfonts.windows-1255=hebrew,alphabetic/1252,dingbats,symbol,symbols
|
||||
sequence.allfonts.windows-1255=hebrew,alphabetic/1252
|
||||
|
||||
sequence.serif.windows-31j=alphabetic,japanese,dingbats,symbol,symbols
|
||||
sequence.sansserif.windows-31j=alphabetic,japanese,dingbats,symbol,symbols
|
||||
sequence.monospaced.windows-31j=japanese,alphabetic,dingbats,symbol,symbols
|
||||
sequence.dialog.windows-31j=alphabetic,japanese,dingbats,symbol,symbols
|
||||
sequence.dialoginput.windows-31j=alphabetic,japanese,dingbats,symbol,symbols
|
||||
sequence.serif.windows-31j=alphabetic,japanese
|
||||
sequence.sansserif.windows-31j=alphabetic,japanese
|
||||
sequence.monospaced.windows-31j=japanese,alphabetic
|
||||
sequence.dialog.windows-31j=alphabetic,japanese
|
||||
sequence.dialoginput.windows-31j=alphabetic,japanese
|
||||
|
||||
sequence.serif.x-windows-949=alphabetic,korean,dingbats,symbol,symbols
|
||||
sequence.sansserif.x-windows-949=alphabetic,korean,dingbats,symbol,symbols
|
||||
sequence.monospaced.x-windows-949=korean,alphabetic,dingbats,symbol,symbols
|
||||
sequence.dialog.x-windows-949=alphabetic,korean,dingbats,symbol,symbols
|
||||
sequence.dialoginput.x-windows-949=alphabetic,korean,dingbats,symbol,symbols
|
||||
sequence.serif.x-windows-949=alphabetic,korean
|
||||
sequence.sansserif.x-windows-949=alphabetic,korean
|
||||
sequence.monospaced.x-windows-949=korean,alphabetic
|
||||
sequence.dialog.x-windows-949=alphabetic,korean
|
||||
sequence.dialoginput.x-windows-949=alphabetic,korean
|
||||
|
||||
sequence.allfonts.x-windows-874=alphabetic,thai,dingbats,symbol,symbols
|
||||
sequence.allfonts.x-windows-874=alphabetic,thai
|
||||
|
||||
sequence.fallback=emoji,\
|
||||
sequence.fallback=emoji,symbols,dingbats,symbol,\
|
||||
chinese-ms950,chinese-hkscs,chinese-ms936,chinese-gb18030,\
|
||||
japanese,korean,chinese-ms950-extb,chinese-ms936-extb,\
|
||||
georgian,devanagari,bengali,gujarati,gurmukhi,kannada,\
|
||||
@@ -261,25 +261,6 @@ sequence.fallback=emoji,\
|
||||
exclusion.alphabetic=0700-1cff,1d80-1e9f,1f00-2017,2020-20ab,20ad-20b8,20bb-20bc,20be-24ff,2501-2501,2503-250b,250d-250f,2511-2513,2515-2517,2519-251b,251d-2523,2525-252b,252d-2533,2535-253b,253d-254f,256d-f8ff
|
||||
exclusion.chinese-gb18030=0390-03d6,2200-22ef,2701-27be
|
||||
exclusion.hebrew=0041-005a,0060-007a,007f-00ff,20ac-20ac
|
||||
exclusion.symbols=000d-0022,0024-0029,002b-002f,003a-00a8,00aa-00ad,00af-02dc,2002-2003,\
|
||||
2005-2005,200d-200d,2013-2014,2018-201a,201c-201e,2020-2022,2026-2026,\
|
||||
2030-2030,2039-203a,2044-2044,20ac-20ac,20e3-20e3,2126-2126,2190-2193,\
|
||||
219a-21a8,21ab-21ff,2206-2206,220f-220f,2211-2212,2219-221a,221e-221e,\
|
||||
222b-222b,2248-2248,2260-2260,231a-231b,23e9-23ec,23f0-23f0,23f3-23f3,\
|
||||
24b6-24c1,24c3-24cf,25a0-25a9,25ac-25b5,25b7-25bf,25c1-25fa,25fd-25ff,\
|
||||
260f-2610,2612-2612,2614-2615,263b-263b,263f-263f,2641-2641,2643-2653,\
|
||||
2672-267a,267c-267d,267f-267f,2693-2693,26a1-26a6,26a8-26ab,26bd-26be,\
|
||||
26c4-26c5,26c7-26c7,26ce-26ce,26d4-26d4,26dd-26dd,26e3-26e3,26ea-26ea,\
|
||||
26f2-26f3,26f5-26f5,26fa-26fa,26fd-26fd,2701-2701,2703-2705,270a-270b,\
|
||||
270e-270e,2710-2710,2713-2713,2715-2715,2717-2718,2728-2728,2731-2732,\
|
||||
2735-2743,2745-2746,2748-274c,274e-274e,2753-2755,2757-2757,2795-2797,\
|
||||
27b0-27b0,27bf-27bf,2936-2937,2b12-2b1c,2b50-2b52,2b55-2b55,3244-3247,\
|
||||
01f000-01f02b,01f0cf-01f0cf,01f172-01f17d,01f180-01f1ff,01f201-01f201,\
|
||||
01f210-01f236,01f238-01f23a,01f250-01f320,01f32d-01f335,01f337-01f37c,\
|
||||
01f37e-01f393,01f3a0-01f3ca,01f3cf-01f3d3,01f3e0-01f3f0,01f3f4-01f3f4,\
|
||||
01f3f8-01f43e,01f440-01f440,01f442-01f4fc,01f4ff-01f53d,01f54b-01f567,\
|
||||
01f57a-01f57a,01f595-01f596,01f5a4-01f5a4,01f5fb-01f64f,01f680-01f6c5,\
|
||||
01f6cc-01f6cc,01f6d0-01f6d2,01f6eb-01f6ec,01f6f4-01f6f6,01f910-01f93a,01f93c-01f9c0
|
||||
|
||||
# Monospaced to Proportional width variant mapping
|
||||
# (Experimental private syntax)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2019, 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
|
||||
@@ -29,16 +29,10 @@ include LibCommon.gmk
|
||||
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
|
||||
CFLAGS_LIBDT_SHMEM := $(CFLAGS_JDKLIB)
|
||||
|
||||
ifneq ($(HOTSPOT_BUILD_TIME), )
|
||||
CFLAGS_LIBDT_SHMEM += -DSHMEM_BUILD_TIME='"$(HOTSPOT_BUILD_TIME)"'
|
||||
endif
|
||||
|
||||
$(eval $(call SetupJdkLibrary, BUILD_LIBDT_SHMEM, \
|
||||
NAME := dt_shmem, \
|
||||
OPTIMIZATION := LOW, \
|
||||
CFLAGS := $(CFLAGS_LIBDT_SHMEM), \
|
||||
CFLAGS := $(CFLAGS_JDKLIB), \
|
||||
EXTRA_HEADER_DIRS := \
|
||||
jdk.jdwp.agent:include \
|
||||
jdk.jdwp.agent:libjdwp/export, \
|
||||
|
||||
@@ -147,13 +147,14 @@ function import_path() {
|
||||
if [[ "$path" != "" ]]; then
|
||||
# Store current unix path
|
||||
unixpath="$path"
|
||||
# If $unixpath does not exist, add .exe (needed on WSL)
|
||||
if [[ ! -e "$unixpath" ]]; then
|
||||
unixpath="$unixpath.exe"
|
||||
fi
|
||||
# Now turn it into a windows path
|
||||
winpath="$($PATHTOOL -w "$unixpath" 2>/dev/null)"
|
||||
if [[ $? -eq 0 && -e "$unixpath" ]]; then
|
||||
winpath="$($PATHTOOL -w "$path" 2>/dev/null)"
|
||||
# If it fails, try again with an added .exe (needed on WSL)
|
||||
if [[ $? -ne 0 ]]; then
|
||||
unixpath="$unixpath.exe"
|
||||
winpath="$($PATHTOOL -w "$unixpath" 2>/dev/null)"
|
||||
fi
|
||||
if [[ $? -eq 0 ]]; then
|
||||
if [[ ! "$winpath" =~ ^"$ENVROOT"\\.*$ ]] ; then
|
||||
# If it is not in envroot, it's a generic windows path
|
||||
if [[ ! $winpath =~ ^[-_.:\\a-zA-Z0-9]*$ ]] ; then
|
||||
|
||||
@@ -129,17 +129,8 @@ static inline uint32_t uimm(uint32_t val, int hi, int lo)
|
||||
|
||||
uint64_t replicate(uint64_t bits, int nbits, int count)
|
||||
{
|
||||
assert(count > 0, "must be");
|
||||
assert(nbits > 0, "must be");
|
||||
assert(count * nbits <= 64, "must be");
|
||||
|
||||
// Special case nbits == 64 since the shift below with that nbits value
|
||||
// would result in undefined behavior.
|
||||
if (nbits == 64) {
|
||||
return bits;
|
||||
}
|
||||
|
||||
uint64_t result = 0;
|
||||
// nbits may be 64 in which case we want mask to be -1
|
||||
uint64_t mask = ones(nbits);
|
||||
for (int i = 0; i < count ; i++) {
|
||||
result <<= nbits;
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.lang.invoke.MethodHandles;
|
||||
public class JBRApiModule {
|
||||
static {
|
||||
JBRApi.registerModule(MethodHandles.lookup(), JBRApiModule.class.getModule()::addExports)
|
||||
.service("com.jetbrains.JBR$ServiceApi")
|
||||
.withStatic("getService", "getService", "com.jetbrains.internal.JBRApi");
|
||||
.service("com.jetbrains.JBR$ServiceApi", null)
|
||||
.withStatic("getService", "com.jetbrains.internal.JBRApi");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.jetbrains.internal;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.*;
|
||||
@@ -88,7 +87,6 @@ import static java.lang.invoke.MethodHandles.Lookup;
|
||||
* user to directly create proxy object.
|
||||
*/
|
||||
public class JBRApi {
|
||||
static final boolean VERBOSE = Boolean.getBoolean("jetbrains.api.verbose");
|
||||
|
||||
private static final Map<String, RegisteredProxyInfo> registeredProxyInfoByInterfaceName = new HashMap<>();
|
||||
private static final Map<String, RegisteredProxyInfo> registeredProxyInfoByTargetName = new HashMap<>();
|
||||
@@ -117,9 +115,6 @@ public class JBRApi {
|
||||
knownServices = Set.of();
|
||||
knownProxies = Set.of();
|
||||
}
|
||||
if (VERBOSE) {
|
||||
System.out.println("JBR API init\nKNOWN_SERVICES = " + knownServices + "\nKNOWN_PROXIES = " + knownProxies);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,12 +136,7 @@ public class JBRApi {
|
||||
RegisteredProxyInfo info = registeredProxyInfoByInterfaceName.get(i.getName());
|
||||
if (info == null) return null;
|
||||
ProxyInfo resolved = ProxyInfo.resolve(info);
|
||||
if (resolved == null) {
|
||||
if (VERBOSE) {
|
||||
System.err.println("Couldn't resolve proxy info: " + i.getName());
|
||||
}
|
||||
return null;
|
||||
} else return new Proxy<>(resolved);
|
||||
return resolved != null ? new Proxy<>(resolved) : null;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -169,17 +159,16 @@ public class JBRApi {
|
||||
RegisteredProxyInfo info = registeredProxyInfoByTargetName.get(targetName);
|
||||
if (info == null) return null;
|
||||
try {
|
||||
return Class.forName(info.interfaceName(), true,
|
||||
(info.type().isPublicApi() ? outerLookup : info.apiModule()).lookupClass().getClassLoader());
|
||||
} catch (ClassNotFoundException e) {
|
||||
if (VERBOSE) e.printStackTrace();
|
||||
return (info.type().isPublicApi() ? outerLookup : info.apiModule())
|
||||
.findClass(info.interfaceName());
|
||||
} catch (ClassNotFoundException | IllegalAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static InternalServiceBuilder internalServiceBuilder(Lookup interFace, String... targets) {
|
||||
public static InternalServiceBuilder internalServiceBuilder(Lookup interFace, String target) {
|
||||
return new InternalServiceBuilder(new RegisteredProxyInfo(
|
||||
interFace, interFace.lookupClass().getName(), targets, ProxyInfo.Type.INTERNAL_SERVICE, new ArrayList<>()));
|
||||
interFace, interFace.lookupClass().getName(), target, ProxyInfo.Type.INTERNAL_SERVICE, new ArrayList<>()));
|
||||
}
|
||||
|
||||
public static class InternalServiceBuilder {
|
||||
@@ -190,9 +179,13 @@ public class JBRApi {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public InternalServiceBuilder withStatic(String interfaceMethodName, String methodName, String... classes) {
|
||||
public InternalServiceBuilder withStatic(String methodName, String clazz) {
|
||||
return withStatic(methodName, clazz, methodName);
|
||||
}
|
||||
|
||||
public InternalServiceBuilder withStatic(String interfaceMethodName, String clazz, String methodName) {
|
||||
info.staticMethods().add(
|
||||
new RegisteredProxyInfo.StaticMethodMapping(interfaceMethodName, methodName, classes));
|
||||
new RegisteredProxyInfo.StaticMethodMapping(interfaceMethodName, clazz, methodName));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -230,24 +223,22 @@ public class JBRApi {
|
||||
this.lookup = lookup;
|
||||
}
|
||||
|
||||
private ModuleRegistry addProxy(ProxyInfo.Type type, String interfaceName, String... targets) {
|
||||
lastProxy = new RegisteredProxyInfo(lookup, interfaceName, targets, type, new ArrayList<>());
|
||||
private ModuleRegistry addProxy(String interfaceName, String target, ProxyInfo.Type type) {
|
||||
lastProxy = new RegisteredProxyInfo(lookup, interfaceName, target, type, new ArrayList<>());
|
||||
registeredProxyInfoByInterfaceName.put(interfaceName, lastProxy);
|
||||
for (String target : targets) {
|
||||
if (target != null) {
|
||||
registeredProxyInfoByTargetName.put(target, lastProxy);
|
||||
}
|
||||
if (targets.length == 1) {
|
||||
validate2WayMapping(lastProxy, registeredProxyInfoByInterfaceName.get(targets[0]));
|
||||
validate2WayMapping(lastProxy, registeredProxyInfoByInterfaceName.get(target));
|
||||
validate2WayMapping(lastProxy, registeredProxyInfoByTargetName.get(interfaceName));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
private static void validate2WayMapping(RegisteredProxyInfo p, RegisteredProxyInfo reverse) {
|
||||
if (reverse != null &&
|
||||
(!p.interfaceName().equals(reverse.targets()[0]) || !p.targets()[0].equals(reverse.interfaceName()))) {
|
||||
(!p.interfaceName().equals(reverse.target()) || !p.target().equals(reverse.interfaceName()))) {
|
||||
throw new IllegalArgumentException("Invalid 2-way proxy mapping: " +
|
||||
p.interfaceName() + " -> " + p.targets()[0] + " & " +
|
||||
reverse.interfaceName() + " -> " + reverse.targets()[0]);
|
||||
p.interfaceName() + " -> " + p.target() + " & " +
|
||||
reverse.interfaceName() + " -> " + reverse.target());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,12 +249,12 @@ public class JBRApi {
|
||||
* it's converted to corresponding {@code interFace} type by creating a proxy object
|
||||
* that implements {@code interFace} and delegates method calls to {@code target}.
|
||||
* @param interFace interface name in {@link com.jetbrains.JBR jetbrains.api} module.
|
||||
* @param targets corresponding class/interface names in current JBR module, first found will be used. This must not be empty.
|
||||
* @param target corresponding class/interface name in current JBR module.
|
||||
* @apiNote class name example: {@code pac.ka.ge.Outer$Inner}
|
||||
*/
|
||||
public ModuleRegistry proxy(String interFace, String... targets) {
|
||||
if (targets.length == 0) throw new IllegalArgumentException("Proxy must have at least one target");
|
||||
return addProxy(ProxyInfo.Type.PROXY, interFace, targets);
|
||||
public ModuleRegistry proxy(String interFace, String target) {
|
||||
Objects.requireNonNull(target);
|
||||
return addProxy(interFace, target, ProxyInfo.Type.PROXY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,11 +262,11 @@ public class JBRApi {
|
||||
* <p>
|
||||
* Service is a singleton, which may be accessed by client using {@link com.jetbrains.JBR} class.
|
||||
* @param interFace interface name in {@link com.jetbrains.JBR jetbrains.api} module.
|
||||
* @param targets corresponding implementation class names in current JBR module, first found will be used.
|
||||
* @param target corresponding implementation class name in current JBR module, or null.
|
||||
* @apiNote class name example: {@code pac.ka.ge.Outer$Inner}
|
||||
*/
|
||||
public ModuleRegistry service(String interFace, String... targets) {
|
||||
return addProxy(ProxyInfo.Type.SERVICE, interFace, targets);
|
||||
public ModuleRegistry service(String interFace, String target) {
|
||||
return addProxy(interFace, target, ProxyInfo.Type.SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,7 +282,7 @@ public class JBRApi {
|
||||
*/
|
||||
public ModuleRegistry clientProxy(String interFace, String target) {
|
||||
Objects.requireNonNull(target);
|
||||
return addProxy(ProxyInfo.Type.CLIENT_PROXY, interFace, target);
|
||||
return addProxy(interFace, target, ProxyInfo.Type.CLIENT_PROXY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -312,24 +303,20 @@ public class JBRApi {
|
||||
}
|
||||
|
||||
/**
|
||||
* Delegate "{@code interfaceMethodName}" method calls to first found static "{@code methodName}" in "{@code classes}".
|
||||
* Delegate interface "{@code methodName}" calls to static "{@code methodName}" in "{@code clazz}".
|
||||
* @see #withStatic(String, String, String)
|
||||
*/
|
||||
public ModuleRegistry withStatic(String interfaceMethodName, String methodName, String... classes) {
|
||||
public ModuleRegistry withStatic(String methodName, String clazz) {
|
||||
return withStatic(methodName, clazz, methodName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delegate "{@code interfaceMethodName}" method calls to static "{@code methodName}" in "{@code clazz}".
|
||||
*/
|
||||
public ModuleRegistry withStatic(String interfaceMethodName, String clazz, String methodName) {
|
||||
lastProxy.staticMethods().add(
|
||||
new RegisteredProxyInfo.StaticMethodMapping(interfaceMethodName, methodName, classes));
|
||||
new RegisteredProxyInfo.StaticMethodMapping(interfaceMethodName, clazz, methodName));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Thrown by service implementations indicating that the service is not available for some reason
|
||||
*/
|
||||
public static class ServiceNotAvailableException extends RuntimeException {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
public ServiceNotAvailableException() { super(); }
|
||||
public ServiceNotAvailableException(String message) { super(message); }
|
||||
public ServiceNotAvailableException(String message, Throwable cause) { super(message, cause); }
|
||||
public ServiceNotAvailableException(Throwable cause) { super(cause); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ class Proxy<INTERFACE> {
|
||||
private volatile MethodHandle constructor;
|
||||
private volatile MethodHandle targetExtractor;
|
||||
|
||||
private volatile boolean instanceInitialized;
|
||||
private volatile INTERFACE instance;
|
||||
|
||||
Proxy(ProxyInfo info) {
|
||||
@@ -195,22 +194,15 @@ class Proxy<INTERFACE> {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
INTERFACE getInstance() {
|
||||
if (instanceInitialized) return instance;
|
||||
if (instance != null) return instance;
|
||||
if (info.type != ProxyInfo.Type.SERVICE) return null;
|
||||
synchronized (this) {
|
||||
if (instance == null) {
|
||||
initDependencyGraph();
|
||||
try {
|
||||
instance = (INTERFACE) getConstructor().invoke();
|
||||
} catch (JBRApi.ServiceNotAvailableException e) {
|
||||
if (JBRApi.VERBOSE) {
|
||||
System.err.println("Service not available: " + info.interFace.getName());
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
instanceInitialized = true;
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
|
||||
@@ -78,7 +78,7 @@ class ProxyDependencyManager {
|
||||
* Collect dependencies for given class and store them into cache.
|
||||
*/
|
||||
private static void step(Node parent, Class<?> clazz) {
|
||||
if (!clazz.getPackageName().startsWith("com.jetbrains") && !JBRApi.isKnownProxyInterface(clazz)) return;
|
||||
if (!clazz.getPackageName().startsWith("com.jetbrains")) return;
|
||||
if (parent != null && parent.findAndMergeCycle(clazz) != null) {
|
||||
return;
|
||||
}
|
||||
@@ -101,9 +101,6 @@ class ProxyDependencyManager {
|
||||
// Otherwise cache will contain incomplete data
|
||||
for (Class<?> c : node.cycle.members) {
|
||||
cache.put(c, node.cycle.dependencies);
|
||||
if (JBRApi.VERBOSE) {
|
||||
System.out.println("Found dependencies for " + c.getName() + ": " + node.cycle.dependencies);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.jetbrains.internal;
|
||||
|
||||
import jdk.internal.org.objectweb.asm.*;
|
||||
import jdk.internal.org.objectweb.asm.util.CheckClassAdapter;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
@@ -55,15 +54,13 @@ class ProxyGenerator {
|
||||
/**
|
||||
* Print warnings about usage of deprecated interfaces and methods to {@link System#err}.
|
||||
*/
|
||||
private static final boolean LOG_DEPRECATED = System.getProperty("jetbrains.api.logDeprecated", String.valueOf(JBRApi.VERBOSE)).equalsIgnoreCase("true");
|
||||
private static final boolean VERIFY_BYTECODE = Boolean.getBoolean("jetbrains.api.verifyBytecode");
|
||||
private static final boolean LOG_DEPRECATED = System.getProperty("jetbrains.api.logDeprecated", "true").equalsIgnoreCase("true");
|
||||
|
||||
private static final AtomicInteger nameCounter = new AtomicInteger();
|
||||
|
||||
private final ProxyInfo info;
|
||||
private final boolean generateBridge;
|
||||
private final String proxyName, bridgeName;
|
||||
private final ClassWriter originalProxyWriter, originalBridgeWriter;
|
||||
private final ClassVisitor proxyWriter, bridgeWriter;
|
||||
private final List<Supplier<MethodHandle>> handles = new ArrayList<>();
|
||||
private final List<Supplier<Class<?>>> classReferences = new ArrayList<>();
|
||||
@@ -80,9 +77,6 @@ class ProxyGenerator {
|
||||
* classes until {@link #defineClasses()} is called.
|
||||
*/
|
||||
ProxyGenerator(ProxyInfo info) {
|
||||
if (JBRApi.VERBOSE) {
|
||||
System.out.println("Generating proxy " + info.interFace.getName());
|
||||
}
|
||||
this.info = info;
|
||||
generateBridge = info.type.isPublicApi();
|
||||
int nameId = nameCounter.getAndIncrement();
|
||||
@@ -90,25 +84,26 @@ class ProxyGenerator {
|
||||
bridgeName = generateBridge ? info.apiModule.lookupClass().getPackageName().replace('.', '/') + "/" +
|
||||
info.interFace.getSimpleName() + "$$JBRApiBridge$" + nameId : null;
|
||||
|
||||
originalProxyWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
|
||||
proxyWriter = VERIFY_BYTECODE ? new CheckClassAdapter(originalProxyWriter, true) : originalProxyWriter;
|
||||
originalBridgeWriter = generateBridge ? new ClassWriter(ClassWriter.COMPUTE_FRAMES) : null;
|
||||
if (generateBridge) {
|
||||
bridgeWriter = VERIFY_BYTECODE ? new CheckClassAdapter(originalBridgeWriter, true) : originalBridgeWriter;
|
||||
} else bridgeWriter = new ClassVisitor(Opcodes.ASM8) { // Empty visitor
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
|
||||
return new MethodVisitor(api) {};
|
||||
class ClassWriter extends jdk.internal.org.objectweb.asm.ClassWriter {
|
||||
ClassWriter() { super(ClassWriter.COMPUTE_FRAMES); }
|
||||
ClassVisitor createEmptyVisitor() {
|
||||
return new ClassVisitor(api) {
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
|
||||
return new MethodVisitor(api) {};
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
ClassWriter proxyClassWriter = new ClassWriter();
|
||||
proxyWriter = proxyClassWriter;
|
||||
bridgeWriter = generateBridge ? new ClassWriter() : proxyClassWriter.createEmptyVisitor();
|
||||
proxyWriter.visit(CLASSFILE_VERSION, ACC_SUPER | ACC_FINAL | ACC_SYNTHETIC, proxyName, null,
|
||||
"java/lang/Object", new String[] {Type.getInternalName(info.interFace)});
|
||||
bridgeWriter.visit(CLASSFILE_VERSION, ACC_SUPER | ACC_FINAL | ACC_SYNTHETIC | ACC_PUBLIC, bridgeName, null,
|
||||
"java/lang/Object", null);
|
||||
generateConstructor();
|
||||
generateMethods();
|
||||
proxyWriter.visitEnd();
|
||||
bridgeWriter.visitEnd();
|
||||
}
|
||||
|
||||
boolean areAllMethodsImplemented() {
|
||||
@@ -192,9 +187,9 @@ class ProxyGenerator {
|
||||
void defineClasses() {
|
||||
try {
|
||||
Lookup bridge = !generateBridge ? null : MethodHandles.privateLookupIn(
|
||||
info.apiModule.defineClass(originalBridgeWriter.toByteArray()), info.apiModule);
|
||||
info.apiModule.defineClass(((ClassWriter) bridgeWriter).toByteArray()), info.apiModule);
|
||||
generatedProxy = info.interFaceLookup.defineHiddenClass(
|
||||
originalProxyWriter.toByteArray(), true, Lookup.ClassOption.STRONG, Lookup.ClassOption.NESTMATE);
|
||||
((ClassWriter) proxyWriter).toByteArray(), true, Lookup.ClassOption.STRONG, Lookup.ClassOption.NESTMATE);
|
||||
generatedHandlesHolder = generateBridge ? bridge : generatedProxy;
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -210,7 +205,6 @@ class ProxyGenerator {
|
||||
if (LOG_DEPRECATED && info.interFace.isAnnotationPresent(Deprecated.class)) {
|
||||
logDeprecated(p, "Warning: using deprecated JBR API interface " + info.interFace.getName());
|
||||
}
|
||||
p.visitCode();
|
||||
p.visitVarInsn(ALOAD, 0);
|
||||
if (info.target != null) {
|
||||
p.visitInsn(DUP);
|
||||
@@ -219,8 +213,7 @@ class ProxyGenerator {
|
||||
}
|
||||
p.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
|
||||
p.visitInsn(RETURN);
|
||||
p.visitMaxs(0, 0);
|
||||
p.visitEnd();
|
||||
p.visitMaxs(-1, -1);
|
||||
}
|
||||
|
||||
private void generateMethods() {
|
||||
@@ -257,11 +250,6 @@ class ProxyGenerator {
|
||||
if (e1 != null) exceptions.add(e1);
|
||||
if (e2 != null) exceptions.add(e2);
|
||||
generateUnsupportedMethod(proxyWriter, method);
|
||||
if (JBRApi.VERBOSE) {
|
||||
System.err.println("Couldn't generate method " + method.getName());
|
||||
if (e1 != null) e1.printStackTrace();
|
||||
if (e2 != null) e2.printStackTrace();
|
||||
}
|
||||
allMethodsImplemented = false;
|
||||
}
|
||||
}
|
||||
@@ -304,8 +292,6 @@ class ProxyGenerator {
|
||||
logDeprecated(p, "Warning: using deprecated JBR API method " +
|
||||
interfaceMethod.getDeclaringClass().getName() + "#" + interfaceMethod.getName());
|
||||
}
|
||||
p.visitCode();
|
||||
b.visitCode();
|
||||
MethodVisitor bp = generateBridge ? b : p;
|
||||
bp.visitFieldInsn(GETSTATIC, bridgeOrProxyName, handleName, MH_DESCRIPTOR);
|
||||
if (passInstance) {
|
||||
@@ -329,10 +315,8 @@ class ProxyGenerator {
|
||||
int returnOpcode = getReturnOpcode(mapping.returnMapping().to());
|
||||
p.visitInsn(returnOpcode);
|
||||
b.visitInsn(returnOpcode);
|
||||
p.visitMaxs(0, 0);
|
||||
b.visitMaxs(0, 0);
|
||||
p.visitEnd();
|
||||
b.visitEnd();
|
||||
p.visitMaxs(-1, -1);
|
||||
b.visitMaxs(-1, -1);
|
||||
}
|
||||
|
||||
private String addHandle(ClassVisitor classWriter, Supplier<MethodHandle> handleSupplier) {
|
||||
|
||||
@@ -19,8 +19,6 @@ package com.jetbrains.internal;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.lang.invoke.MethodHandles.Lookup;
|
||||
|
||||
@@ -42,14 +40,12 @@ class ProxyInfo {
|
||||
type = i.type();
|
||||
interFaceLookup = lookup(getInterfaceLookup(), i.interfaceName());
|
||||
interFace = interFaceLookup == null ? null : interFaceLookup.lookupClass();
|
||||
target = Stream.of(i.targets())
|
||||
.map(t -> lookup(getTargetLookup(), t))
|
||||
.filter(Objects::nonNull).findFirst().orElse(null);
|
||||
target = i.target() == null ? null : lookup(getTargetLookup(), i.target());
|
||||
for (RegisteredProxyInfo.StaticMethodMapping m : i.staticMethods()) {
|
||||
Stream.of(m.classes())
|
||||
.map(t -> lookup(getTargetLookup(), t))
|
||||
.filter(Objects::nonNull).findFirst()
|
||||
.ifPresent(l -> staticMethods.put(m.interfaceMethodName(), new StaticMethodMapping(l, m.methodName())));
|
||||
Lookup l = lookup(getTargetLookup(), m.clazz());
|
||||
if (l != null) {
|
||||
staticMethods.put(m.interfaceMethodName(), new StaticMethodMapping(l, m.methodName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ import java.util.List;
|
||||
*/
|
||||
record RegisteredProxyInfo(MethodHandles.Lookup apiModule,
|
||||
String interfaceName,
|
||||
String[] targets,
|
||||
String target,
|
||||
ProxyInfo.Type type,
|
||||
List<StaticMethodMapping> staticMethods) {
|
||||
|
||||
record StaticMethodMapping(String interfaceMethodName, String methodName, String[] classes) {}
|
||||
record StaticMethodMapping(String interfaceMethodName, String clazz, String methodName) {}
|
||||
}
|
||||
|
||||
@@ -74,12 +74,11 @@ public final class CGraphicsDevice extends GraphicsDevice
|
||||
public CGraphicsDevice(final int displayID) {
|
||||
this.displayID = displayID;
|
||||
this.initialMode = getDisplayMode();
|
||||
StringBuilder errorMessage = new StringBuilder();
|
||||
|
||||
if (MacOSFlags.isMetalEnabled()) {
|
||||
// Try to create MTLGraphicsConfig, if it fails,
|
||||
// try to create CGLGraphicsConfig as a fallback
|
||||
this.config = MTLGraphicsConfig.getConfig(this, displayID, errorMessage);
|
||||
this.config = MTLGraphicsConfig.getConfig(this, displayID);
|
||||
|
||||
if (this.config != null) {
|
||||
metalPipelineEnabled = true;
|
||||
@@ -89,7 +88,7 @@ public final class CGraphicsDevice extends GraphicsDevice
|
||||
// Should not fall back to OpenGL if Metal has been used before
|
||||
// (it could cause CCE during replace of surface data)
|
||||
throw new InternalError("Error - unable to initialize Metal" +
|
||||
" after recreation of graphics device." + errorMessage);
|
||||
" after recreation of graphics device.");
|
||||
}
|
||||
|
||||
// Try falling back to OpenGL pipeline
|
||||
@@ -120,7 +119,7 @@ public final class CGraphicsDevice extends GraphicsDevice
|
||||
" rendering pipeline");
|
||||
}
|
||||
|
||||
this.config = MTLGraphicsConfig.getConfig(this, displayID, errorMessage);
|
||||
this.config = MTLGraphicsConfig.getConfig(this, displayID);
|
||||
|
||||
if (this.config != null) {
|
||||
metalPipelineEnabled = true;
|
||||
@@ -132,7 +131,7 @@ public final class CGraphicsDevice extends GraphicsDevice
|
||||
// This indicates fallback to other rendering pipeline also failed.
|
||||
// Should never reach here
|
||||
throw new InternalError("Error - unable to initialize any" +
|
||||
" rendering pipeline." + errorMessage);
|
||||
" rendering pipeline.");
|
||||
}
|
||||
|
||||
if (metalPipelineEnabled && MacOSFlags.isMetalVerbose()) {
|
||||
|
||||
@@ -32,36 +32,22 @@ public final class CCompositeGlyphMapper extends CompositeGlyphMapper {
|
||||
super(compFont);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int charToVariationGlyph(int unicode, int variationSelector) {
|
||||
if (variationSelector == 0) return charToGlyph(unicode);
|
||||
else {
|
||||
int glyph = convertToGlyph(unicode, variationSelector);
|
||||
if (glyph == missingGlyph) glyph = charToGlyph(unicode);
|
||||
return glyph;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int convertToGlyph(int unicode) {
|
||||
int glyph = convertToGlyph(unicode, 0);
|
||||
setCachedGlyphCode(unicode, glyph);
|
||||
return glyph;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int convertToGlyph(int unicode, int variationSelector) {
|
||||
CCompositeFont compositeFont = (CCompositeFont) font;
|
||||
CFont mainFont = (CFont) font.getSlotFont(0);
|
||||
String[] fallbackFontInfo = new String[2];
|
||||
int glyphCode = nativeCodePointToGlyph(mainFont.getNativeFontPtr(), unicode, variationSelector, fallbackFontInfo);
|
||||
int glyphCode = nativeCodePointToGlyph(mainFont.getNativeFontPtr(), unicode, fallbackFontInfo);
|
||||
if (glyphCode == missingGlyph) {
|
||||
setCachedGlyphCode(unicode, missingGlyph);
|
||||
return missingGlyph;
|
||||
}
|
||||
String fallbackFontName = fallbackFontInfo[0];
|
||||
String fallbackFontFamilyName = fallbackFontInfo[1];
|
||||
if (fallbackFontName == null || fallbackFontFamilyName == null) {
|
||||
return compositeGlyphCode(0, glyphCode);
|
||||
int result = compositeGlyphCode(0, glyphCode);
|
||||
setCachedGlyphCode(unicode, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
int slot = compositeFont.findSlot(fallbackFontName);
|
||||
@@ -82,10 +68,12 @@ public final class CCompositeGlyphMapper extends CompositeGlyphMapper {
|
||||
slot = compositeFont.addSlot((CFont) fallbackFont);
|
||||
}
|
||||
|
||||
return compositeGlyphCode(slot, glyphCode);
|
||||
int result = compositeGlyphCode(slot, glyphCode);
|
||||
setCachedGlyphCode(unicode, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// This invokes native font fallback mechanism, returning information about font (its Postscript and family names)
|
||||
// able to display a given character, and corresponding glyph code
|
||||
private static native int nativeCodePointToGlyph(long nativeFontPtr, int codePoint, int variationSelector, String[] result);
|
||||
private static native int nativeCodePointToGlyph(long nativeFontPtr, int codePoint, String[] result);
|
||||
}
|
||||
@@ -67,12 +67,6 @@ public final class CStrike extends PhysicalStrike {
|
||||
double x,
|
||||
double y);
|
||||
|
||||
private static native void getNativeGlyphRenderData(long nativeStrikePtr,
|
||||
int glyphCode,
|
||||
double x,
|
||||
double y,
|
||||
GlyphRenderData result);
|
||||
|
||||
private static native void getNativeGlyphOutlineBounds(long nativeStrikePtr,
|
||||
int glyphCode,
|
||||
float [] rectData);
|
||||
@@ -236,12 +230,6 @@ public final class CStrike extends PhysicalStrike {
|
||||
throw new Error("not implemented yet");
|
||||
}
|
||||
|
||||
GlyphRenderData getGlyphRenderData(int glyphCode, float x, float y) {
|
||||
GlyphRenderData result = new GlyphRenderData();
|
||||
getNativeGlyphRenderData(getNativeStrikePtr(), glyphCode, x, y, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// called from the Sun2D renderer
|
||||
long getGlyphImagePtr(int glyphCode) {
|
||||
synchronized (glyphInfoCache) {
|
||||
|
||||
@@ -83,8 +83,4 @@ public class NativeStrike extends PhysicalStrike {
|
||||
return null;
|
||||
}
|
||||
|
||||
GlyphRenderData getGlyphRenderData(int glyphCode, float x, float y) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
package sun.java2d.metal;
|
||||
|
||||
import java.lang.annotation.Native;
|
||||
import sun.awt.CGraphicsConfig;
|
||||
import sun.awt.CGraphicsDevice;
|
||||
import sun.awt.image.OffScreenImage;
|
||||
@@ -73,11 +72,6 @@ import static sun.java2d.metal.MTLContext.MTLContextCaps.CAPS_EXT_BIOP_SHADER;
|
||||
public final class MTLGraphicsConfig extends CGraphicsConfig
|
||||
implements AccelGraphicsConfig, SurfaceManager.ProxiedGraphicsConfig
|
||||
{
|
||||
@Native private final static int LOAD_LIB_ERROR = -1;
|
||||
@Native private final static int LOAD_LIB_OK = 0;
|
||||
@Native private final static int LOAD_LIB_NO_DEVICE = 1;
|
||||
@Native private final static int LOAD_LIB_NO_SHADER_LIB = 2;
|
||||
|
||||
private static boolean mtlAvailable;
|
||||
private static boolean mtlUsed = false;
|
||||
private static ImageCapabilities imageCaps = new MTLImageCaps();
|
||||
@@ -97,7 +91,7 @@ public final class MTLGraphicsConfig extends CGraphicsConfig
|
||||
private final int maxTextureSize;
|
||||
|
||||
private static native boolean isMetalFrameworkAvailable();
|
||||
private static native int tryLoadMetalLibrary(int displayID, String shaderLib);
|
||||
private static native boolean tryLoadMetalLibrary(int displayID, String shaderLib);
|
||||
private static native long getMTLConfigInfo(int displayID, String mtlShadersLib);
|
||||
|
||||
/**
|
||||
@@ -138,29 +132,21 @@ public final class MTLGraphicsConfig extends CGraphicsConfig
|
||||
}
|
||||
|
||||
public static MTLGraphicsConfig getConfig(CGraphicsDevice device,
|
||||
int displayID, StringBuilder errorMessage)
|
||||
int displayID)
|
||||
{
|
||||
if (!mtlAvailable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!tryLoadMetalLibrary(displayID, mtlShadersLib)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
long cfginfo = 0;
|
||||
int textureSize = 0;
|
||||
MTLRenderQueue rq = MTLRenderQueue.getInstance();
|
||||
rq.lock();
|
||||
try {
|
||||
int res = tryLoadMetalLibrary(displayID, mtlShadersLib);
|
||||
if (res != LOAD_LIB_OK) {
|
||||
errorMessage.append(" Cannot load metal library: " +
|
||||
switch (res) {
|
||||
case LOAD_LIB_ERROR -> "Unexpected error.";
|
||||
case LOAD_LIB_NO_DEVICE -> "No MTLDevice.";
|
||||
case LOAD_LIB_NO_SHADER_LIB -> "No Metal shader library.";
|
||||
default -> throw new IllegalStateException("Unexpected value: " + res);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
cfginfo = getMTLConfigInfo(displayID, mtlShadersLib);
|
||||
if (cfginfo != 0L) {
|
||||
textureSize = nativeGetMaxTextureSize();
|
||||
@@ -174,7 +160,6 @@ public final class MTLGraphicsConfig extends CGraphicsConfig
|
||||
rq.unlock();
|
||||
}
|
||||
if (cfginfo == 0) {
|
||||
errorMessage.append(" Cannot create MTLConfigInfo.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -964,7 +964,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean res = !focusedWindowChangeAllowed || parentPeer.requestWindowFocus(cause);
|
||||
boolean res = parentPeer.requestWindowFocus(cause);
|
||||
// If parent window can be made focused and has been made focused (synchronously)
|
||||
// then we can proceed with children, otherwise we retreat
|
||||
if (!res || !parentWindow.isFocused()) {
|
||||
|
||||
@@ -271,7 +271,6 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
nativeEndComposition(getNativeViewPtr(fAwtFocussedComponentPeer));
|
||||
}
|
||||
|
||||
fAwtFocussedComponent = null;
|
||||
fAwtFocussedComponentPeer = null;
|
||||
}
|
||||
|
||||
@@ -282,32 +281,34 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
* to talk to when responding to key events.
|
||||
*/
|
||||
protected void setAWTFocussedComponent(Component component) {
|
||||
if (component == null || component == fAwtFocussedComponent) {
|
||||
// Sometimes input happens for the natively unfocused window
|
||||
// (e.g. in case of system emoji picker),
|
||||
// so we don't reset last focused component on focus lost.
|
||||
return;
|
||||
}
|
||||
LWComponentPeer<?, ?> peer = null;
|
||||
long modelPtr = 0;
|
||||
CInputMethod imInstance = this;
|
||||
|
||||
if (fAwtFocussedComponentPeer != null) {
|
||||
long modelPtr = getNativeViewPtr(fAwtFocussedComponentPeer);
|
||||
nativeNotifyPeer(modelPtr, null);
|
||||
}
|
||||
// component will be null when we are told there's no focused component.
|
||||
// When that happens we need to notify the native architecture to stop generating IMEs
|
||||
if (component == null) {
|
||||
peer = fAwtFocussedComponentPeer;
|
||||
imInstance = null;
|
||||
} else {
|
||||
peer = getNearestNativePeer(component);
|
||||
|
||||
fAwtFocussedComponent = component;
|
||||
fAwtFocussedComponentPeer = getNearestNativePeer(component);
|
||||
|
||||
if (fAwtFocussedComponentPeer != null) {
|
||||
long modelPtr = getNativeViewPtr(fAwtFocussedComponentPeer);
|
||||
|
||||
CInputMethod imInstance = this;
|
||||
// If we have a passive client, don't pass input method events to it.
|
||||
if (component.getInputMethodRequests() == null) {
|
||||
imInstance = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (peer != null) {
|
||||
modelPtr = getNativeViewPtr(peer);
|
||||
|
||||
// modelPtr refers to the ControlModel that either got or lost focus.
|
||||
nativeNotifyPeer(modelPtr, imInstance);
|
||||
}
|
||||
|
||||
// Track the focused component and its nearest peer.
|
||||
fAwtFocussedComponent = component;
|
||||
fAwtFocussedComponentPeer = getNearestNativePeer(component);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,8 +101,13 @@ final class CPlatformResponder {
|
||||
}
|
||||
|
||||
int jmodifiers = NSEvent.nsToJavaModifiers(modifierFlags);
|
||||
if ((jeventType == MouseEvent.MOUSE_PRESSED) && (jbuttonNumber > MouseEvent.NOBUTTON)) {
|
||||
jmodifiers |= MouseEvent.getMaskForButton(jbuttonNumber);
|
||||
|
||||
if (!"false".equalsIgnoreCase(System.getProperty("jbr4765.forceMousePressedButtonModifier", "true"))) {
|
||||
// JBR-4765: NSEvent.nsToJavaModifiers returns 0 for right taps.
|
||||
// So ensure the pressed mouse button is also reflected by the appropriate modifier.
|
||||
if ((jeventType == MouseEvent.MOUSE_PRESSED) && (jbuttonNumber > MouseEvent.NOBUTTON)) {
|
||||
jmodifiers |= InputEvent.getMaskForButton(jbuttonNumber);
|
||||
}
|
||||
}
|
||||
|
||||
boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers);
|
||||
|
||||
@@ -78,7 +78,7 @@ import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
|
||||
private native long nativeCreateNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h, double transparentTitleBarHeight);
|
||||
private native long nativeCreateNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h);
|
||||
private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
|
||||
private static native void nativeSetNSWindowAppearance(long nsWindowPtr, String appearanceName);
|
||||
private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
|
||||
@@ -107,7 +107,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
private static native void nativeRaiseLevel(long nsWindowPtr, boolean popup, boolean onlyIfParentIsActive);
|
||||
private static native void nativeSetTransparentTitleBarHeight(long nsWindowPtr, float height);
|
||||
private static native void nativeCallDeliverMoveResizeEvent(long nsWindowPtr);
|
||||
private static native void nativeSetRoundedCorners(long nsWindowPrt, float radius, int borderWidth, int borderColor);
|
||||
|
||||
// Loger to report issues happened during execution but that do not affect functionality
|
||||
private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow");
|
||||
@@ -141,7 +140,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
public static final String WINDOW_TITLE_VISIBLE = "apple.awt.windowTitleVisible";
|
||||
public static final String WINDOW_APPEARANCE = "apple.awt.windowAppearance";
|
||||
public static final String WINDOW_TRANSPARENT_TITLE_BAR_HEIGHT = "apple.awt.windowTransparentTitleBarHeight";
|
||||
public static final String WINDOW_CORNER_RADIUS = "apple.awt.windowCornerRadius";
|
||||
|
||||
// This system property is named as jdk.* because it is not specific to AWT
|
||||
// and it is also used in JavaFX
|
||||
@@ -294,18 +292,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
new Property<CPlatformWindow>(WINDOW_TRANSPARENT_TITLE_BAR_HEIGHT) {
|
||||
public void applyProperty(final CPlatformWindow c, final Object value) {
|
||||
if (value != null && (value instanceof Float)) {
|
||||
boolean enabled = (float) value != 0f;
|
||||
c.setStyleBits(FULL_WINDOW_CONTENT, enabled);
|
||||
c.setStyleBits(TRANSPARENT_TITLE_BAR, enabled);
|
||||
c.setStyleBits(TITLE_VISIBLE, !enabled);
|
||||
c.execute(ptr -> AWTThreading.executeWaitToolkit(wait -> nativeSetTransparentTitleBarHeight(ptr, (float) value)));
|
||||
}
|
||||
}
|
||||
},
|
||||
new Property<CPlatformWindow>(WINDOW_CORNER_RADIUS) {
|
||||
public void applyProperty(final CPlatformWindow c, final Object value) {
|
||||
c.setRoundedCorners(value);
|
||||
}
|
||||
}
|
||||
}) {
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -373,8 +362,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
responder = createPlatformResponder();
|
||||
contentView.initialize(peer, responder);
|
||||
|
||||
float transparentTitleBarHeight = getTransparentTitleBarHeight(_target);
|
||||
|
||||
Rectangle bounds;
|
||||
if (!IS(DECORATED, styleBits)) {
|
||||
// For undecorated frames the move/resize event does not come if the frame is centered on the screen
|
||||
@@ -395,7 +382,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
+ ", bounds=" + bounds);
|
||||
}
|
||||
long windowPtr = createNSWindow(viewPtr, ownerPtr, styleBits,
|
||||
bounds.x, bounds.y, bounds.width, bounds.height, transparentTitleBarHeight);
|
||||
bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("window created: " + Long.toHexString(windowPtr));
|
||||
}
|
||||
@@ -410,7 +397,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
+ ", bounds=" + bounds);
|
||||
}
|
||||
long windowPtr = createNSWindow(viewPtr, 0, styleBits,
|
||||
bounds.x, bounds.y, bounds.width, bounds.height, transparentTitleBarHeight);
|
||||
bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("window created: " + Long.toHexString(windowPtr));
|
||||
}
|
||||
@@ -572,14 +559,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
if (prop != null) {
|
||||
styleBits = SET(styleBits, TITLE_VISIBLE, Boolean.parseBoolean(prop.toString()));
|
||||
}
|
||||
|
||||
prop = rootpane.getClientProperty(WINDOW_TRANSPARENT_TITLE_BAR_HEIGHT);
|
||||
if (prop != null) {
|
||||
boolean enabled = Float.parseFloat(prop.toString()) != 0f;
|
||||
styleBits = SET(styleBits, FULL_WINDOW_CONTENT, enabled);
|
||||
styleBits = SET(styleBits, TRANSPARENT_TITLE_BAR, enabled);
|
||||
styleBits = SET(styleBits, TITLE_VISIBLE, !enabled);
|
||||
}
|
||||
}
|
||||
|
||||
if (isDialog) {
|
||||
@@ -1216,6 +1195,12 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
* Callbacks from the AWTWindow and AWTView objc classes.
|
||||
*************************************************************/
|
||||
private void deliverWindowFocusEvent(boolean gained, CPlatformWindow opposite){
|
||||
// Fix for 7150349: ingore "gained" notifications when the app is inactive.
|
||||
if (gained && !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) {
|
||||
focusLogger.fine("the app is inactive, so the notification is ignored");
|
||||
return;
|
||||
}
|
||||
|
||||
LWWindowPeer oppositePeer = (opposite == null)? null : opposite.getPeer();
|
||||
responder.handleWindowFocusEvent(gained, oppositePeer);
|
||||
}
|
||||
@@ -1452,16 +1437,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
return false;
|
||||
}
|
||||
|
||||
private long createNSWindow(long nsViewPtr,
|
||||
long ownerPtr,
|
||||
long styleBits,
|
||||
double x,
|
||||
double y,
|
||||
double w,
|
||||
double h,
|
||||
double transparentTitleBarHeight) {
|
||||
return AWTThreading.executeWaitToolkit(() ->
|
||||
nativeCreateNSWindow(nsViewPtr, ownerPtr, styleBits, x, y, w, h, transparentTitleBarHeight));
|
||||
private long createNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h) {
|
||||
return AWTThreading.executeWaitToolkit(() -> nativeCreateNSWindow(nsViewPtr, ownerPtr, styleBits, x, y, w, h));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -1495,49 +1472,20 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
isFullScreenAnimationOn = false;
|
||||
}
|
||||
|
||||
private float getTransparentTitleBarHeight(Window target) {
|
||||
if (target instanceof javax.swing.RootPaneContainer) {
|
||||
final javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane();
|
||||
if (rootpane != null) {
|
||||
Object transparentTitleBarHeightProperty = rootpane.getClientProperty(WINDOW_TRANSPARENT_TITLE_BAR_HEIGHT);
|
||||
if (transparentTitleBarHeightProperty != null) {
|
||||
return Float.parseFloat(transparentTitleBarHeightProperty.toString());
|
||||
// JBR API internals
|
||||
private static void setCustomDecorationTitleBarHeight(Window target, ComponentPeer peer, float height) {
|
||||
if (peer instanceof LWComponentPeer) {
|
||||
PlatformWindow platformWindow = ((LWComponentPeer<?, ?>) peer).getPlatformWindow();
|
||||
if (platformWindow instanceof CPlatformWindow) {
|
||||
((CPlatformWindow) platformWindow).execute(ptr -> {
|
||||
AWTThreading.executeWaitToolkit(wait -> nativeSetTransparentTitleBarHeight(ptr, height));
|
||||
});
|
||||
if (target instanceof javax.swing.RootPaneContainer) {
|
||||
final javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane();
|
||||
if (rootpane != null) rootpane.putClientProperty(WINDOW_TRANSPARENT_TITLE_BAR_HEIGHT, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0f;
|
||||
}
|
||||
|
||||
// JBR API internals
|
||||
private static void setCustomDecorationTitleBarHeight(Window target, ComponentPeer peer, float height) {
|
||||
if (target instanceof javax.swing.RootPaneContainer) {
|
||||
final javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane();
|
||||
if (rootpane != null) rootpane.putClientProperty(WINDOW_TRANSPARENT_TITLE_BAR_HEIGHT, height);
|
||||
}
|
||||
}
|
||||
|
||||
// JBR API internals
|
||||
private static void setRoundedCorners(Window window, Object params) {
|
||||
Object peer = AWTAccessor.getComponentAccessor().getPeer(window);
|
||||
if (peer instanceof CPlatformWindow) {
|
||||
((CPlatformWindow)peer).setRoundedCorners(params);
|
||||
} else if (window instanceof RootPaneContainer) {
|
||||
JRootPane rootpane = ((RootPaneContainer)window).getRootPane();
|
||||
if (rootpane != null) {
|
||||
rootpane.putClientProperty(WINDOW_CORNER_RADIUS, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setRoundedCorners(Object params) {
|
||||
if (params instanceof Float) {
|
||||
execute(ptr -> nativeSetRoundedCorners(ptr, (float) params, 0, 0));
|
||||
} else if (params instanceof Object[]) {
|
||||
Object[] values = (Object[]) params;
|
||||
if (values.length == 3 && values[0] instanceof Float && values[1] instanceof Integer && values[2] instanceof Color) {
|
||||
Color color = (Color) values[2];
|
||||
execute(ptr -> nativeSetRoundedCorners(ptr, (float) values[0], (int) values[1], color.getRGB()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,9 +50,7 @@ final class CWrapper {
|
||||
static void makeKeyAndOrderFront(long window) {
|
||||
AWTThreading.executeWaitToolkit(wait -> nativeMakeKeyAndOrderFront(window, wait));
|
||||
}
|
||||
static void makeKeyWindow(long window) {
|
||||
AWTThreading.executeWaitToolkit(wait -> nativeMakeKeyWindow(window, wait));
|
||||
}
|
||||
static native void makeKeyWindow(long window);
|
||||
static native void makeMainWindow(long window);
|
||||
static native boolean canBecomeMainWindow(long window);
|
||||
static native boolean isKeyWindow(long window);
|
||||
@@ -73,7 +71,6 @@ final class CWrapper {
|
||||
}
|
||||
|
||||
private static native void nativeOrderOut(long window, boolean wait);
|
||||
private static native void nativeMakeKeyWindow(long window, boolean wait);
|
||||
private static native void nativeMakeKeyAndOrderFront(long window, boolean wait);
|
||||
|
||||
/**
|
||||
|
||||
@@ -416,7 +416,7 @@ AWT_NS_WINDOW_IMPLEMENTATION
|
||||
}
|
||||
|
||||
if (IS(mask, TITLE_VISIBLE) && [self.nsWindow respondsToSelector:@selector(setTitleVisibility:)]) {
|
||||
[self.nsWindow setTitleVisibility:(IS(bits, TITLE_VISIBLE) ? NSWindowTitleVisible : NSWindowTitleHidden)];
|
||||
[self.nsWindow setTitleVisibility:(IS(bits, TITLE_VISIBLE)) ? NSWindowTitleVisible :NSWindowTitleHidden];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -426,7 +426,6 @@ AWT_NS_WINDOW_IMPLEMENTATION
|
||||
styleBits:(jint)bits
|
||||
frameRect:(NSRect)rect
|
||||
contentView:(NSView *)view
|
||||
transparentTitleBarHeight:(CGFloat)transparentTitleBarHeight
|
||||
{
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
@@ -487,11 +486,6 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
self.nsWindow.collectionBehavior = NSWindowCollectionBehaviorManaged;
|
||||
self.isEnterFullScreen = NO;
|
||||
|
||||
_transparentTitleBarHeight = transparentTitleBarHeight;
|
||||
if (transparentTitleBarHeight != 0.0 && !self.isFullScreen) {
|
||||
[self setUpTransparentTitleBar];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -1024,7 +1018,7 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
#ifdef DEBUG
|
||||
NSLog(@"resigned key: %d %@ %@", [self.nsWindow isMainWindow], [self.nsWindow title], [self menuBarForWindow]);
|
||||
#endif
|
||||
if (![self.nsWindow isMainWindow] || [NSApp keyWindow] == self.nsWindow) {
|
||||
if (![self.nsWindow isMainWindow]) {
|
||||
[self deactivateWindow];
|
||||
}
|
||||
}
|
||||
@@ -1053,9 +1047,7 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
NSWindow *keyWindow = [NSApp keyWindow];
|
||||
AWTWindow *opposite = nil;
|
||||
if ([AWTWindow isAWTWindow: keyWindow]) {
|
||||
if (keyWindow != self.nsWindow) {
|
||||
opposite = (AWTWindow *)[keyWindow delegate];
|
||||
}
|
||||
opposite = (AWTWindow *)[keyWindow delegate];
|
||||
[AWTWindow setLastKeyWindow: self];
|
||||
} else {
|
||||
[AWTWindow setLastKeyWindow: nil];
|
||||
@@ -1451,32 +1443,38 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
- (void) setTransparentTitleBarHeight: (CGFloat) transparentTitleBarHeight
|
||||
{
|
||||
if (_transparentTitleBarHeight == transparentTitleBarHeight) return;
|
||||
|
||||
if (_transparentTitleBarHeight != 0.0f) {
|
||||
_transparentTitleBarHeight = transparentTitleBarHeight;
|
||||
if (transparentTitleBarHeight == 0.0f) {
|
||||
if (!self.isFullScreen) {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[self.nsWindow setTitlebarAppearsTransparent:NO];
|
||||
[self.nsWindow setTitleVisibility:NSWindowTitleVisible];
|
||||
[self.nsWindow setStyleMask:[self.nsWindow styleMask]&(~NSWindowStyleMaskFullSizeContentView)];
|
||||
|
||||
if (!self.isFullScreen) {
|
||||
[self resetTitleBar];
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (_transparentTitleBarHeightConstraint != nil || _transparentTitleBarButtonCenterXConstraints != nil) {
|
||||
[self updateTransparentTitleBarConstraints];
|
||||
}
|
||||
} else {
|
||||
_transparentTitleBarHeight = transparentTitleBarHeight;
|
||||
if (!self.isFullScreen) {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[self.nsWindow setTitlebarAppearsTransparent:YES];
|
||||
[self.nsWindow setTitleVisibility:NSWindowTitleHidden];
|
||||
[self.nsWindow setStyleMask:[self.nsWindow styleMask]|NSWindowStyleMaskFullSizeContentView];
|
||||
|
||||
if (!self.isFullScreen) {
|
||||
[self setUpTransparentTitleBar];
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@end // AWTWindow
|
||||
|
||||
@implementation AWTWindowDragView {
|
||||
CGFloat _accumulatedDragDelta;
|
||||
enum WindowDragState {
|
||||
NO_DRAG, // Mouse not dragging
|
||||
SKIP_DRAG, // Mouse dragging in non-draggable area
|
||||
@@ -1497,9 +1495,9 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (jint)hitTestCustomDecoration:(NSPoint)point
|
||||
- (BOOL)isInDraggableArea:(NSPoint)point
|
||||
{
|
||||
jint returnValue = java_awt_Window_CustomWindowDecoration_NO_HIT_SPOT;
|
||||
BOOL returnValue = YES;
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
|
||||
jobject platformWindow = (*env)->NewLocalRef(env, self.javaPlatformWindow);
|
||||
if (platformWindow != NULL) {
|
||||
@@ -1511,7 +1509,8 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
if (awtWindow != NULL) {
|
||||
NSRect frame = [self.window frame];
|
||||
float windowHeight = frame.size.height;
|
||||
returnValue = (*env)->CallIntMethod(env, awtWindow, jm_hitTestCustomDecoration, (jint) point.x, (jint) (windowHeight - point.y));
|
||||
returnValue = (*env)->CallIntMethod(env, awtWindow, jm_hitTestCustomDecoration, (jint) point.x, (jint) (windowHeight - point.y)) ==
|
||||
(jint) java_awt_Window_CustomWindowDecoration_NO_HIT_SPOT ? YES : NO;
|
||||
CHECK_EXCEPTION();
|
||||
(*env)->DeleteLocalRef(env, awtWindow);
|
||||
}
|
||||
@@ -1523,7 +1522,6 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
- (void)mouseDown:(NSEvent *)event
|
||||
{
|
||||
_draggingWindow = NO_DRAG;
|
||||
_accumulatedDragDelta = 0.0;
|
||||
// We don't follow the regular responder chain here since the native window swallows events in some cases
|
||||
[[self.window contentView] deliverJavaMouseEvent:event];
|
||||
}
|
||||
@@ -1531,17 +1529,12 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
- (void)mouseDragged:(NSEvent *)event
|
||||
{
|
||||
if (_draggingWindow == NO_DRAG) {
|
||||
jint hitSpot = [self hitTestCustomDecoration:event.locationInWindow];
|
||||
switch (hitSpot) {
|
||||
case java_awt_Window_CustomWindowDecoration_DRAGGABLE_AREA:
|
||||
// Start drag only after 4px threshold inside DRAGGABLE_AREA
|
||||
if ((_accumulatedDragDelta += fabs(event.deltaX) + fabs(event.deltaY)) <= 4.0) break;
|
||||
case java_awt_Window_CustomWindowDecoration_NO_HIT_SPOT:
|
||||
[self.window performWindowDragWithEvent:event];
|
||||
_draggingWindow = DRAG;
|
||||
break;
|
||||
default:
|
||||
_draggingWindow = SKIP_DRAG;
|
||||
BOOL shouldStartWindowDrag = [self isInDraggableArea:event.locationInWindow];
|
||||
if (shouldStartWindowDrag) {
|
||||
[self.window performWindowDragWithEvent:event];
|
||||
_draggingWindow = DRAG;
|
||||
} else {
|
||||
_draggingWindow = SKIP_DRAG;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1551,13 +1544,8 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
if (_draggingWindow == DRAG) {
|
||||
_draggingWindow = NO_DRAG;
|
||||
} else {
|
||||
jint hitSpot = [self hitTestCustomDecoration:event.locationInWindow];
|
||||
if (event.clickCount == 2 && hitSpot == java_awt_Window_CustomWindowDecoration_NO_HIT_SPOT) {
|
||||
if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AppleActionOnDoubleClick"] isEqualToString:@"Maximize"]) {
|
||||
[self.window performZoom:nil];
|
||||
} else {
|
||||
[self.window performMiniaturize:nil];
|
||||
}
|
||||
if (event.clickCount == 2 && [self isInDraggableArea:event.locationInWindow]) {
|
||||
[self.window performZoom:nil];
|
||||
}
|
||||
|
||||
// We don't follow the regular responder chain here since the native window swallows events in some cases
|
||||
@@ -1589,10 +1577,10 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetAllowAutom
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CPlatformWindow
|
||||
* Method: nativeCreateNSWindow
|
||||
* Signature: (JJIDDDDD)J
|
||||
* Signature: (JJIIII)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeCreateNSWindow
|
||||
(JNIEnv *env, jobject obj, jlong contentViewPtr, jlong ownerPtr, jlong styleBits, jdouble x, jdouble y, jdouble w, jdouble h, jdouble transparentTitleBarHeight)
|
||||
(JNIEnv *env, jobject obj, jlong contentViewPtr, jlong ownerPtr, jlong styleBits, jdouble x, jdouble y, jdouble w, jdouble h)
|
||||
{
|
||||
__block AWTWindow *window = nil;
|
||||
|
||||
@@ -1619,8 +1607,7 @@ JNI_COCOA_ENTER(env);
|
||||
ownerWindow:owner
|
||||
styleBits:styleBits
|
||||
frameRect:frameRect
|
||||
contentView:contentView
|
||||
transparentTitleBarHeight:(CGFloat)transparentTitleBarHeight];
|
||||
contentView:contentView];
|
||||
// the window is released is CPlatformWindow.nativeDispose()
|
||||
|
||||
if (window) {
|
||||
@@ -1712,8 +1699,8 @@ JNI_COCOA_EXIT(env);
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CPlatformWindow
|
||||
* Method: nativeSetNSWindowAppearance
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
* Method: nativeSetNSWindowStyleBits
|
||||
* Signature: (JII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowAppearance
|
||||
(JNIEnv *env, jclass clazz, jlong windowPtr, jstring appearanceName)
|
||||
@@ -2393,36 +2380,3 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeCallDeliverMo
|
||||
|
||||
JNI_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetRoundedCorners
|
||||
(JNIEnv *env, jclass clazz, jlong windowPtr, jfloat radius, jint borderWidth, jint borderRgb)
|
||||
{
|
||||
JNI_COCOA_ENTER(env);
|
||||
|
||||
NSWindow *w = (NSWindow *)jlong_to_ptr(windowPtr);
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
w.hasShadow = YES;
|
||||
w.contentView.wantsLayer = YES;
|
||||
w.contentView.layer.cornerRadius = radius;
|
||||
w.contentView.layer.masksToBounds = YES;
|
||||
|
||||
if (borderWidth > 0) {
|
||||
CGFloat alpha = (((borderRgb >> 24) & 0xff) / 255.0);
|
||||
CGFloat red = (((borderRgb >> 16) & 0xff) / 255.0);
|
||||
CGFloat green = (((borderRgb >> 8) & 0xff) / 255.0);
|
||||
CGFloat blue = (((borderRgb >> 0) & 0xff) / 255.0);
|
||||
NSColor *color = [NSColor colorWithDeviceRed:red green:green blue:blue alpha:alpha];
|
||||
|
||||
w.contentView.layer.borderWidth = borderWidth;
|
||||
w.contentView.layer.borderColor = color.CGColor;
|
||||
}
|
||||
|
||||
w.backgroundColor = NSColor.clearColor;
|
||||
w.opaque = NO;
|
||||
// remove corner radius animation
|
||||
[w.contentView.layer removeAllAnimations];
|
||||
[w invalidateShadow];
|
||||
}];
|
||||
|
||||
JNI_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
@@ -50,12 +50,12 @@ JNI_COCOA_EXIT(env);
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CWrapper$NSWindow
|
||||
* Method: nativeMakeKeyWindow
|
||||
* Signature: (JZ)V
|
||||
* Method: makeKeyWindow
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_nativeMakeKeyWindow
|
||||
(JNIEnv *env, jclass cls, jlong windowPtr, jboolean wait)
|
||||
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_makeKeyWindow
|
||||
(JNIEnv *env, jclass cls, jlong windowPtr)
|
||||
{
|
||||
JNI_COCOA_ENTER(env);
|
||||
|
||||
@@ -63,7 +63,7 @@ JNI_COCOA_ENTER(env);
|
||||
[ThreadUtilities performOnMainThread:@selector(makeKeyWindow)
|
||||
on:window
|
||||
withObject:nil
|
||||
waitUntilDone:(BOOL)wait];
|
||||
waitUntilDone:NO];
|
||||
|
||||
JNI_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
@@ -218,11 +218,20 @@ JNI_COCOA_ENTER(env);
|
||||
JNI_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
jobject getGlyphOutline(JNIEnv *env, AWTStrike *awtStrike,
|
||||
CTFontRef font, CGGlyph glyph,
|
||||
jdouble xPos, jdouble yPos)
|
||||
/*
|
||||
* Class: sun_font_CStrike
|
||||
* Method: getNativeGlyphOutline
|
||||
* Signature: (JJIDD)Ljava/awt/geom/GeneralPath;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_sun_font_CStrike_getNativeGlyphOutline
|
||||
(JNIEnv *env, jclass clazz,
|
||||
jlong awtStrikePtr, jint glyphCode, jdouble xPos, jdouble yPos)
|
||||
{
|
||||
jobject generalPath = NULL;
|
||||
|
||||
JNI_COCOA_ENTER(env);
|
||||
|
||||
AWTPathRef path = NULL;
|
||||
jfloatArray pointCoords = NULL;
|
||||
jbyteArray pointTypes = NULL;
|
||||
@@ -232,11 +241,21 @@ jobject getGlyphOutline(JNIEnv *env, AWTStrike *awtStrike,
|
||||
|
||||
AWT_FONT_CLEANUP_SETUP;
|
||||
|
||||
AWTStrike *awtStrike = (AWTStrike *)jlong_to_ptr(awtStrikePtr);
|
||||
AWTFont *awtfont = awtStrike->fAWTFont;
|
||||
|
||||
AWT_FONT_CLEANUP_CHECK(awtfont);
|
||||
|
||||
// inverting the shear order and sign to compensate for the flipped coordinate system
|
||||
CGAffineTransform tx = awtStrike->fTx;
|
||||
tx.tx += xPos;
|
||||
tx.ty += yPos;
|
||||
|
||||
// get the right font and glyph for this "Java GlyphCode"
|
||||
|
||||
CGGlyph glyph;
|
||||
const CTFontRef font = CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode(awtfont, glyphCode, &glyph);
|
||||
|
||||
// get the advance of this glyph
|
||||
CGSize advance;
|
||||
CTFontGetAdvancesForGlyphs(font, kCTFontDefaultOrientation, &glyph, &advance, 1);
|
||||
@@ -249,6 +268,7 @@ AWT_FONT_CLEANUP_CHECK(path);
|
||||
tx = awtStrike->fTx;
|
||||
tx = CGAffineTransformConcat(tx, sInverseTX);
|
||||
AWTGetGlyphOutline(&glyph, (NSFont *)font, &advance, &tx, 0, 1, &path);
|
||||
CFRelease(font);
|
||||
|
||||
pointCoords = (*env)->NewFloatArray(env, path->fNumberOfDataElements);
|
||||
AWT_FONT_CLEANUP_CHECK(pointCoords);
|
||||
@@ -282,190 +302,10 @@ cleanup:
|
||||
}
|
||||
|
||||
AWT_FONT_CLEANUP_FINISH;
|
||||
JNI_COCOA_EXIT(env);
|
||||
return generalPath;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_font_CStrike
|
||||
* Method: getNativeGlyphOutline
|
||||
* Signature: (JJIDD)Ljava/awt/geom/GeneralPath;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_sun_font_CStrike_getNativeGlyphOutline
|
||||
(JNIEnv *env, jclass clazz,
|
||||
jlong awtStrikePtr, jint glyphCode, jdouble xPos, jdouble yPos) {
|
||||
jobject generalPath = NULL;
|
||||
|
||||
JNI_COCOA_ENTER(env);
|
||||
AWT_FONT_CLEANUP_SETUP;
|
||||
|
||||
AWTStrike *awtStrike = (AWTStrike *)jlong_to_ptr(awtStrikePtr);
|
||||
AWTFont *awtfont = awtStrike->fAWTFont;
|
||||
AWT_FONT_CLEANUP_CHECK(awtfont);
|
||||
|
||||
// get the right font and glyph for this "Java GlyphCode"
|
||||
CGGlyph glyph;
|
||||
const CTFontRef font = CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode(awtfont, glyphCode, &glyph);
|
||||
|
||||
generalPath = getGlyphOutline(env, awtStrike, font, glyph, xPos, yPos);
|
||||
|
||||
cleanup:
|
||||
CFRelease(font);
|
||||
|
||||
AWT_FONT_CLEANUP_FINISH;
|
||||
JNI_COCOA_EXIT(env);
|
||||
|
||||
return generalPath;
|
||||
}
|
||||
|
||||
// OpenType data is Big-Endian
|
||||
#define GET_BE_INT32(data, i) CFSwapInt32BigToHost(*(const UInt32*) ((const UInt8*) (data) + (i)))
|
||||
#define GET_BE_INT16(data, i) CFSwapInt16BigToHost(*(const UInt16*) ((const UInt8*) (data) + (i)))
|
||||
|
||||
static bool addBitmapRenderData(JNIEnv *env, AWTStrike *awtStrike,
|
||||
CTFontRef font, CGGlyph glyph,
|
||||
jdouble xPos, jdouble yPos, jobject result) {
|
||||
bool success = false;
|
||||
|
||||
DECLARE_CLASS_RETURN(jc_GlyphRenderData, "sun/font/GlyphRenderData", false);
|
||||
DECLARE_METHOD_RETURN(GlyphRenderDataAddBitmap, jc_GlyphRenderData, "addBitmap", "(DDDDDDIIII[I)V", false);
|
||||
|
||||
AWT_FONT_CLEANUP_SETUP;
|
||||
|
||||
CTFontDescriptorRef descriptor = NULL;
|
||||
CGFontRef cgFont = CTFontCopyGraphicsFont(font, &descriptor);
|
||||
|
||||
CFDataRef sbixTable = CGFontCopyTableForTag(cgFont, kCTFontTableSbix);
|
||||
if (sbixTable == NULL) goto cleanup;
|
||||
|
||||
// Parse sbix table
|
||||
CFIndex sbixSize = CFDataGetLength(sbixTable);
|
||||
if (sbixSize < 8) goto cleanup; // Corrupted table
|
||||
const UInt8* sbix = CFDataGetBytePtr(sbixTable);
|
||||
UInt32 numStrikes = GET_BE_INT32(sbix, 4);
|
||||
if (8 + 4 * numStrikes > sbixSize) goto cleanup; // Corrupted table
|
||||
// Find last strike which has data for our glyph
|
||||
// Last is usually the biggest
|
||||
const UInt8* glyphData = NULL;
|
||||
UInt32 size;
|
||||
UInt16 ppem, ppi;
|
||||
for (int i = numStrikes - 1; i >= 0; i--) {
|
||||
const UInt8* strike = sbix + GET_BE_INT32(sbix, 8 + 4 * i);
|
||||
if (strike + 12 + 4 * glyph > sbix + sbixSize) goto cleanup; // Corrupted table
|
||||
UInt32 offset = GET_BE_INT32(strike, 4 + 4 * glyph);
|
||||
size = GET_BE_INT32(strike, 8 + 4 * glyph) - offset;
|
||||
if (size > 0) {
|
||||
ppem = GET_BE_INT16(strike, 0);
|
||||
ppi = GET_BE_INT16(strike, 2);
|
||||
glyphData = strike + offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (glyphData == NULL) goto cleanup;
|
||||
if (glyphData + 4 > sbix + sbixSize) goto cleanup; // Corrupted table
|
||||
|
||||
// Read glyph data
|
||||
FourCharCode graphicType = GET_BE_INT32(glyphData, 4);
|
||||
glyphData += 8;
|
||||
size -= 8;
|
||||
if (glyphData + size > sbix + sbixSize) goto cleanup; // Corrupted table
|
||||
|
||||
// Decode glyph image
|
||||
CGDataProviderRef dataProvider = CGDataProviderCreateWithData(NULL, glyphData, size, NULL);
|
||||
CGImageRef image = NULL;
|
||||
if (graphicType == 'jpg ') {
|
||||
image = CGImageCreateWithJPEGDataProvider(dataProvider, NULL, false, kCGRenderingIntentDefault);
|
||||
} else if (graphicType == 'png ') {
|
||||
image = CGImageCreateWithPNGDataProvider(dataProvider, NULL, false, kCGRenderingIntentDefault);
|
||||
}
|
||||
CGDataProviderRelease(dataProvider);
|
||||
|
||||
if (image != NULL) {
|
||||
CGBitmapInfo info = CGImageGetBitmapInfo(image);
|
||||
size_t bits = CGImageGetBitsPerPixel(image);
|
||||
jint colorModel = -1;
|
||||
if (info & (kCGImageAlphaPremultipliedLast | kCGImageAlphaLast)) colorModel = 0; // RGBA
|
||||
else if (info & (kCGImageAlphaPremultipliedFirst | kCGImageAlphaFirst)) colorModel = 1; // ARGB
|
||||
if (colorModel != -1 && (info & kCGBitmapFloatComponents) == 0 && bits == 32) {
|
||||
size_t width = CGImageGetWidth(image);
|
||||
size_t height = CGImageGetHeight(image);
|
||||
size_t pitch = CGImageGetBytesPerRow(image) / 4;
|
||||
dataProvider = CGImageGetDataProvider(image);
|
||||
CFDataRef data = CGDataProviderCopyData(dataProvider);
|
||||
|
||||
jbyteArray array = (*env)->NewIntArray(env, pitch * height);
|
||||
(*env)->SetIntArrayRegion(env, array, 0, pitch * height, (const jint*) CFDataGetBytePtr(data));
|
||||
CFRelease(data);
|
||||
|
||||
double pointSize = 72.0 * ppem / ppi;
|
||||
double scale = 1.0 / pointSize;
|
||||
font = CTFontCreateWithGraphicsFont(cgFont, pointSize, NULL, descriptor);
|
||||
CGRect bbox = CTFontGetBoundingRectsForGlyphs(font, kCTFontOrientationDefault, &glyph, NULL, 1);
|
||||
CFRelease(font);
|
||||
double tx = bbox.origin.x + xPos * pointSize / awtStrike->fSize;
|
||||
double ty = -bbox.origin.y - (double) height + yPos * pointSize / awtStrike->fSize;
|
||||
|
||||
jdouble m00 = awtStrike->fTx.a * scale, m10 = awtStrike->fTx.b * scale;
|
||||
jdouble m01 = -awtStrike->fTx.c * scale, m11 = -awtStrike->fTx.d * scale;
|
||||
jdouble m02 = m00 * tx + m01 * ty, m12 = m10 * tx + m11 * ty;
|
||||
|
||||
(*env)->CallVoidMethod(env, result, GlyphRenderDataAddBitmap,
|
||||
m00, m10, m01, m11, m02, m12,
|
||||
width, height, pitch, 0, array);
|
||||
success = true;
|
||||
}
|
||||
CGImageRelease(image);
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
cleanup:
|
||||
if (sbixTable) CFRelease(sbixTable);
|
||||
if (cgFont) CFRelease(cgFont);
|
||||
if (descriptor) CFRelease(descriptor);
|
||||
|
||||
AWT_FONT_CLEANUP_FINISH;
|
||||
return success;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_font_CStrike
|
||||
* Method: getNativeGlyphRenderData
|
||||
* Signature: (JIDDLsun/font/GlyphRenderData;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_font_CStrike_getNativeGlyphRenderData
|
||||
(JNIEnv *env, jclass clazz,
|
||||
jlong awtStrikePtr, jint glyphCode, jdouble xPos, jdouble yPos, jobject result)
|
||||
{
|
||||
JNI_COCOA_ENTER(env);
|
||||
|
||||
DECLARE_CLASS(jc_GlyphRenderData, "sun/font/GlyphRenderData");
|
||||
DECLARE_FIELD(GlyphRenderDataOutline, jc_GlyphRenderData, "outline", "Ljava/awt/geom/GeneralPath;")
|
||||
|
||||
AWT_FONT_CLEANUP_SETUP;
|
||||
|
||||
AWTStrike *awtStrike = (AWTStrike *)jlong_to_ptr(awtStrikePtr);
|
||||
AWTFont *awtfont = awtStrike->fAWTFont;
|
||||
AWT_FONT_CLEANUP_CHECK(awtfont);
|
||||
|
||||
// get the right font and glyph for this "Java GlyphCode"
|
||||
CGGlyph glyph;
|
||||
const CTFontRef font = CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode(awtfont, glyphCode, &glyph);
|
||||
|
||||
if (!addBitmapRenderData(env, awtStrike, font, glyph, xPos, yPos, result)) {
|
||||
jobject gp = getGlyphOutline(env, awtStrike, font, glyph, xPos, yPos);
|
||||
if (gp != NULL) {
|
||||
(*env)->SetObjectField(env, result, GlyphRenderDataOutline, gp);
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
CFRelease(font);
|
||||
|
||||
AWT_FONT_CLEANUP_FINISH;
|
||||
JNI_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_font_CStrike
|
||||
* Method: getNativeGlyphOutlineBounds
|
||||
|
||||
@@ -118,17 +118,16 @@ JNI_COCOA_EXIT(env);
|
||||
/*
|
||||
* Class: sun_font_CCompositeGlyphMapper
|
||||
* Method: nativeCodePointToGlyph
|
||||
* Signature: (JII[Ljava/lang/String;)I
|
||||
* Signature: (JI[Ljava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_font_CCompositeGlyphMapper_nativeCodePointToGlyph
|
||||
(JNIEnv *env, jclass clazz, jlong awtFontPtr, jint codePoint, jint variationSelector, jobjectArray resultArray)
|
||||
(JNIEnv *env, jclass clazz, jlong awtFontPtr, jint codePoint, jobjectArray resultArray)
|
||||
{
|
||||
JNI_COCOA_ENTER(env);
|
||||
AWTFont *awtFont = (AWTFont *)jlong_to_ptr(awtFontPtr);
|
||||
CFStringRef fontNames[] = {NULL, NULL};
|
||||
CGGlyph glyph = CTS_CopyGlyphAndFontNamesForCodePoint(awtFont, (UnicodeScalarValue)codePoint,
|
||||
(UnicodeScalarValue)variationSelector, fontNames);
|
||||
CGGlyph glyph = CTS_CopyGlyphAndFontNamesForCodePoint(awtFont, (UnicodeScalarValue)codePoint, fontNames);
|
||||
if (glyph > 0) {
|
||||
jstring fontName = NSStringToJavaString(env, (NSString *)fontNames[0]);
|
||||
(*env)->SetObjectArrayElement(env, resultArray, 0, fontName);
|
||||
|
||||
@@ -35,10 +35,6 @@
|
||||
#define HI_SURROGATE_END 0xDBFF
|
||||
#define LO_SURROGATE_START 0xDC00
|
||||
#define LO_SURROGATE_END 0xDFFF
|
||||
#define VS_START 0xFE00
|
||||
#define VS_END 0xFE0F
|
||||
#define VSS_START 0xE0100
|
||||
#define VSS_END 0xE01FF
|
||||
|
||||
/*
|
||||
* Transform Unicode characters into glyphs.
|
||||
@@ -61,14 +57,11 @@ CTFontRef CTS_CopyCTFallbackFontAndGlyphForUnicode(const AWTFont *font, const UT
|
||||
// Transform a single Unicode character code into glyph code.
|
||||
// Names of the relevant font are also returned, if the substitution is used.
|
||||
// Non-null components of fontNames array should always be released by the calling code, regardless of the returned value.
|
||||
CGGlyph CTS_CopyGlyphAndFontNamesForCodePoint(const AWTFont *font, const UnicodeScalarValue codePoint, const UnicodeScalarValue variationSelector, CFStringRef fontNames[]);
|
||||
CGGlyph CTS_CopyGlyphAndFontNamesForCodePoint(const AWTFont *font, const UnicodeScalarValue codePoint, CFStringRef fontNames[]);
|
||||
|
||||
// Breakup a 32 bit unicode value into the component surrogate pairs
|
||||
void CTS_BreakupUnicodeIntoSurrogatePairs(int uniChar, UTF16Char charRef[]);
|
||||
|
||||
// Get number of UTF16 values from 32 bit unicode value (2 for surrogate pair and 1 otherwise)
|
||||
int CTS_GetUnicodeSize(const UnicodeScalarValue unicode);
|
||||
|
||||
|
||||
// Basic struct that holds everything CoreText is interested in
|
||||
typedef struct CTS_ProviderStruct {
|
||||
|
||||
@@ -88,44 +88,29 @@ ReleaseCTStateDictionary(CFDictionaryRef ctStateDict)
|
||||
CFRelease(ctStateDict); // GC
|
||||
}
|
||||
|
||||
int NextUnicode(const UniChar unicodes[], UnicodeScalarValue *codePoint, const size_t index, const size_t limit) {
|
||||
if (index >= limit) return 0;
|
||||
UniChar unicode = unicodes[index];
|
||||
UniChar nextUnicode = (index+1) < limit ? unicodes[index+1] : 0;
|
||||
bool surrogatePair = unicode >= HI_SURROGATE_START && unicode <= HI_SURROGATE_END
|
||||
&& nextUnicode >= LO_SURROGATE_START && nextUnicode <= LO_SURROGATE_END;
|
||||
*codePoint = surrogatePair ? (((int)(unicode - HI_SURROGATE_START)) << 10)
|
||||
+ nextUnicode - LO_SURROGATE_START + 0x10000 : unicode;
|
||||
return surrogatePair ? 2 : 1;
|
||||
}
|
||||
|
||||
void GetFontsAndGlyphsForCharacters(CTFontRef font, CTFontRef fallbackBase,
|
||||
const UniChar unicodes[], CGGlyph glyphs[], jint glyphsAsInts[],
|
||||
CTFontRef actualFonts[], const size_t count)
|
||||
{
|
||||
CTFontGetGlyphsForCharacters(font, unicodes, glyphs, count);
|
||||
if (!fallbackBase) fallbackBase = font;
|
||||
size_t i, size;
|
||||
for (i = 0; i < count; i += size) {
|
||||
UnicodeScalarValue codePoint, variationCodePoint;
|
||||
int codePointSize = size = NextUnicode(unicodes, &codePoint, i, count);
|
||||
if (size == 0) break;
|
||||
|
||||
int variationSize = NextUnicode(unicodes, &variationCodePoint, i + size , count);
|
||||
bool hasVariationSelector = variationSize > 0 &&
|
||||
((variationCodePoint >= VSS_START && variationCodePoint <= VSS_END) ||
|
||||
(variationCodePoint >= VS_START && variationCodePoint <= VS_END));
|
||||
if (hasVariationSelector) size += variationSize;
|
||||
size_t i;
|
||||
for (i = 0; i < count; i++) {
|
||||
UniChar unicode = unicodes[i];
|
||||
UniChar nextUnicode = (i+1) < count ? unicodes[i+1] : 0;
|
||||
bool surrogatePair = unicode >= HI_SURROGATE_START && unicode <= HI_SURROGATE_END
|
||||
&& nextUnicode >= LO_SURROGATE_START && nextUnicode <= LO_SURROGATE_END;
|
||||
|
||||
CGGlyph glyph = glyphs[i];
|
||||
if (glyph > 0 && (!hasVariationSelector || glyphs[i + codePointSize] > 0)) {
|
||||
if (glyph > 0) {
|
||||
glyphsAsInts[i] = glyph;
|
||||
if (surrogatePair) i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
const CTFontRef fallback = JRSFontCreateFallbackFontForCharacters(fallbackBase, &unicodes[i], size);
|
||||
const CTFontRef fallback = JRSFontCreateFallbackFontForCharacters(fallbackBase, &unicodes[i], surrogatePair ? 2 : 1);
|
||||
if (fallback) {
|
||||
CTFontGetGlyphsForCharacters(fallback, &unicodes[i], &glyphs[i], size);
|
||||
CTFontGetGlyphsForCharacters(fallback, &unicodes[i], &glyphs[i], surrogatePair ? 2 : 1);
|
||||
glyph = glyphs[i];
|
||||
if (actualFonts && glyph > 0) {
|
||||
actualFonts[i] = fallback;
|
||||
@@ -135,10 +120,13 @@ void GetFontsAndGlyphsForCharacters(CTFontRef font, CTFontRef fallbackBase,
|
||||
}
|
||||
|
||||
if (glyph > 0) {
|
||||
int codePoint = surrogatePair ? (((int)(unicode - HI_SURROGATE_START)) << 10)
|
||||
+ nextUnicode - LO_SURROGATE_START + 0x10000 : unicode;
|
||||
glyphsAsInts[i] = -codePoint; // set the glyph code to the negative unicode value
|
||||
} else {
|
||||
glyphsAsInts[i] = 0; // CoreText couldn't find a glyph for this character either
|
||||
}
|
||||
if (surrogatePair) i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,26 +150,17 @@ void CTS_GetGlyphsAsIntsForCharacters
|
||||
* Names of the corresponding substituted font are also returned if substitution is performed.
|
||||
*/
|
||||
CGGlyph CTS_CopyGlyphAndFontNamesForCodePoint
|
||||
(const AWTFont *font, const UnicodeScalarValue codePoint, const UnicodeScalarValue variationSelector, CFStringRef fontNames[])
|
||||
(const AWTFont *font, const UnicodeScalarValue codePoint, CFStringRef fontNames[])
|
||||
{
|
||||
CTFontRef fontRef = (CTFontRef)font->fFont;
|
||||
CTFontRef fallbackBase = (CTFontRef)font->fFallbackBase;
|
||||
int codePointSize = CTS_GetUnicodeSize(codePoint);
|
||||
int count = codePointSize + (variationSelector == 0 ? 0 : CTS_GetUnicodeSize(variationSelector));
|
||||
int count = codePoint >= 0x10000 ? 2 : 1;
|
||||
UTF16Char unicodes[count];
|
||||
if (codePoint < 0x10000) {
|
||||
if (count == 1) {
|
||||
unicodes[0] = (UTF16Char)codePoint;
|
||||
} else {
|
||||
CTS_BreakupUnicodeIntoSurrogatePairs(codePoint, unicodes);
|
||||
}
|
||||
if (variationSelector != 0) {
|
||||
UTF16Char* codes = &unicodes[codePointSize];
|
||||
if (variationSelector < 0x10000) {
|
||||
codes[0] = (UTF16Char)variationSelector;
|
||||
} else {
|
||||
CTS_BreakupUnicodeIntoSurrogatePairs(variationSelector, codes);
|
||||
}
|
||||
}
|
||||
CGGlyph glyphs[count];
|
||||
jint glyphsAsInts[count];
|
||||
CTFontRef actualFonts[count];
|
||||
@@ -267,7 +246,3 @@ void CTS_BreakupUnicodeIntoSurrogatePairs(int uniChar, UTF16Char charRef[]) {
|
||||
charRef[0] = high_surrogate;
|
||||
charRef[1] = low_surrogate;
|
||||
}
|
||||
|
||||
int CTS_GetUnicodeSize(const UnicodeScalarValue unicode) {
|
||||
return unicode >= 0x10000 ? 2 : 1;
|
||||
}
|
||||
|
||||
@@ -70,11 +70,11 @@ Java_sun_java2d_metal_MTLGraphicsConfig_isMetalFrameworkAvailable
|
||||
return metalSupported;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_java2d_metal_MTLGraphicsConfig_tryLoadMetalLibrary
|
||||
(JNIEnv *env, jclass mtlgc, jint displayID, jstring shadersLibName)
|
||||
{
|
||||
__block jint ret = sun_java2d_metal_MTLGraphicsConfig_LOAD_LIB_ERROR;
|
||||
__block jboolean ret = JNI_FALSE;
|
||||
|
||||
JNI_COCOA_ENTER(env);
|
||||
|
||||
@@ -87,14 +87,12 @@ JNI_COCOA_ENTER(env);
|
||||
NSError* error = nil;
|
||||
id<MTLLibrary> lib = [device newLibraryWithFile:path error:&error];
|
||||
if (lib != nil) {
|
||||
ret = sun_java2d_metal_MTLGraphicsConfig_LOAD_LIB_OK;
|
||||
ret = JNI_TRUE;
|
||||
} else {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLGraphicsConfig_tryLoadMetalLibrary - Failed to load Metal shader library.");
|
||||
ret = sun_java2d_metal_MTLGraphicsConfig_LOAD_LIB_NO_SHADER_LIB;
|
||||
}
|
||||
} else {
|
||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "MTLGraphicsConfig_tryLoadMetalLibrary - Failed to create MTLDevice.");
|
||||
ret = sun_java2d_metal_MTLGraphicsConfig_LOAD_LIB_NO_DEVICE;
|
||||
}
|
||||
}];
|
||||
|
||||
|
||||
@@ -26,17 +26,11 @@ import java.lang.invoke.MethodHandles;
|
||||
public class JBRApiModule {
|
||||
static {
|
||||
JBRApi.registerModule(MethodHandles.lookup(), JBRApiModule.class.getModule()::addExports)
|
||||
.service("com.jetbrains.ExtendedGlyphCache")
|
||||
.withStatic("getSubpixelResolution", "getSubpixelResolution", "sun.font.FontUtilities")
|
||||
.service("com.jetbrains.JBRFileDialogService")
|
||||
.withStatic("getFileDialog", "get", "com.jetbrains.desktop.JBRFileDialog")
|
||||
.service("com.jetbrains.ExtendedGlyphCache", null)
|
||||
.withStatic("getSubpixelResolution", "sun.font.FontUtilities")
|
||||
.service("com.jetbrains.JBRFileDialogService", null)
|
||||
.withStatic("getFileDialog", "com.jetbrains.desktop.JBRFileDialog", "get")
|
||||
.proxy("com.jetbrains.JBRFileDialog", "com.jetbrains.desktop.JBRFileDialog")
|
||||
.service("com.jetbrains.CustomWindowDecoration", "java.awt.Window$CustomWindowDecoration")
|
||||
.service("com.jetbrains.RoundedCornersManager")
|
||||
.withStatic("setRoundedCorners", "setRoundedCorners", "sun.lwawt.macosx.CPlatformWindow",
|
||||
"sun.awt.windows.WWindowPeer")
|
||||
.service("com.jetbrains.DesktopActions")
|
||||
.withStatic("setHandler", "setDesktopActionsHandler", "java.awt.Desktop")
|
||||
.clientProxy("java.awt.Desktop$DesktopActionsHandler", "com.jetbrains.DesktopActions$Handler");
|
||||
.service("com.jetbrains.CustomWindowDecoration", "java.awt.Window$CustomWindowDecoration");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ import java.awt.peer.DesktopPeer;
|
||||
import java.io.File;
|
||||
import java.io.FilePermission;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.security.AccessController;
|
||||
@@ -429,11 +428,7 @@ public class Desktop {
|
||||
checkActionSupport(Action.OPEN);
|
||||
checkFileValidation(file);
|
||||
|
||||
final DesktopActions localHandler = actions;
|
||||
if (localHandler != null && localHandler.openSupported)
|
||||
localHandler.handler.open(file);
|
||||
else
|
||||
peer.open(file);
|
||||
peer.open(file);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -468,12 +463,7 @@ public class Desktop {
|
||||
if (file.isDirectory()) {
|
||||
throw new IOException(file.getPath() + " is a directory");
|
||||
}
|
||||
|
||||
final DesktopActions localHandler = actions;
|
||||
if (localHandler != null && localHandler.editSupported)
|
||||
localHandler.handler.edit(file);
|
||||
else
|
||||
peer.edit(file);
|
||||
peer.edit(file);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -509,12 +499,7 @@ public class Desktop {
|
||||
if (file.isDirectory()) {
|
||||
throw new IOException(file.getPath() + " is a directory");
|
||||
}
|
||||
|
||||
final DesktopActions localHandler = actions;
|
||||
if (localHandler != null && localHandler.printSupported)
|
||||
localHandler.handler.print(file);
|
||||
else
|
||||
peer.print(file);
|
||||
peer.print(file);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -545,12 +530,7 @@ public class Desktop {
|
||||
checkExec();
|
||||
checkActionSupport(Action.BROWSE);
|
||||
Objects.requireNonNull(uri);
|
||||
|
||||
final DesktopActions localHandler = actions;
|
||||
if (localHandler != null && localHandler.browseSupported)
|
||||
localHandler.handler.browse(uri);
|
||||
else
|
||||
peer.browse(uri);
|
||||
peer.browse(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -620,11 +600,7 @@ public class Desktop {
|
||||
throw new IllegalArgumentException("URI scheme is not \"mailto\"");
|
||||
}
|
||||
|
||||
final DesktopActions localHandler = actions;
|
||||
if (localHandler != null && localHandler.mailSupported)
|
||||
localHandler.handler.mail(mailtoURI);
|
||||
else
|
||||
peer.mail(mailtoURI);
|
||||
peer.mail(mailtoURI);
|
||||
}
|
||||
|
||||
private void checkExec() throws SecurityException {
|
||||
@@ -1071,44 +1047,4 @@ public class Desktop {
|
||||
});
|
||||
return peer.moveToTrash(file);
|
||||
}
|
||||
|
||||
private interface DesktopActionsHandler {
|
||||
void open(File file) throws IOException;
|
||||
void edit(File file) throws IOException;
|
||||
void print(File file) throws IOException;
|
||||
void mail(URI mailtoURL) throws IOException;
|
||||
void browse(URI uri) throws IOException;
|
||||
}
|
||||
private static class DesktopActions {
|
||||
private final DesktopActionsHandler handler;
|
||||
|
||||
private final boolean openSupported, editSupported, printSupported, mailSupported, browseSupported;
|
||||
|
||||
private static boolean isImplemented(Object target, String method, Class<?>... params) throws NoSuchMethodException {
|
||||
return !target.getClass().getMethod(method, params)
|
||||
.getDeclaringClass().getName().equals("com.jetbrains.DesktopActions$Handler");
|
||||
}
|
||||
|
||||
private DesktopActions(DesktopActionsHandler handler) throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException {
|
||||
this.handler = handler;
|
||||
// Check which methods are actually implemented
|
||||
Field targetField = handler.getClass().getDeclaredField("target");
|
||||
targetField.setAccessible(true);
|
||||
Object target = targetField.get(handler);
|
||||
openSupported = isImplemented(target, "open", File.class);
|
||||
editSupported = isImplemented(target, "edit", File.class);
|
||||
printSupported = isImplemented(target, "print", File.class);
|
||||
mailSupported = isImplemented(target, "mail", URI.class);
|
||||
browseSupported = isImplemented(target, "browse", URI.class);
|
||||
}
|
||||
}
|
||||
private static volatile DesktopActions actions;
|
||||
|
||||
static void setDesktopActionsHandler(DesktopActionsHandler h) {
|
||||
try {
|
||||
actions = new DesktopActions(h);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +152,17 @@ public abstract class KeyboardFocusManager
|
||||
public Container getCurrentFocusCycleRoot() {
|
||||
return KeyboardFocusManager.currentFocusCycleRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enqueueKeyEvents(Component untilFocused) {
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().enqueueKeyEvents(
|
||||
Toolkit.getEventQueue().getMostRecentKeyEventTime(), untilFocused);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dequeueKeyEvents(Component untilFocused) {
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().dequeueKeyEvents(-1, untilFocused);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4027,20 +4027,13 @@ public class Window extends Container implements Accessible {
|
||||
|
||||
private static class CustomWindowDecoration {
|
||||
|
||||
CustomWindowDecoration() {
|
||||
if (Win.INSTANCE == null && MacOS.INSTANCE == null) {
|
||||
throw new JBRApi.ServiceNotAvailableException("Only supported on Windows and macOS");
|
||||
}
|
||||
}
|
||||
|
||||
@Native public static final int
|
||||
NO_HIT_SPOT = 0,
|
||||
OTHER_HIT_SPOT = 1,
|
||||
MINIMIZE_BUTTON = 2,
|
||||
MAXIMIZE_BUTTON = 3,
|
||||
CLOSE_BUTTON = 4,
|
||||
MENU_BAR = 5,
|
||||
DRAGGABLE_AREA = 6;
|
||||
MENU_BAR = 5;
|
||||
|
||||
void setCustomDecorationEnabled(Window window, boolean enabled) {
|
||||
window.hasCustomDecoration = enabled;
|
||||
@@ -4074,14 +4067,14 @@ public class Window extends Container implements Accessible {
|
||||
}
|
||||
|
||||
private interface Win {
|
||||
Win INSTANCE = (Win) JBRApi.internalServiceBuilder(MethodHandles.lookup())
|
||||
.withStatic("updateCustomDecoration", "updateCustomDecoration", "sun.awt.windows.WFramePeer").build();
|
||||
Win INSTANCE = (Win) JBRApi.internalServiceBuilder(MethodHandles.lookup(), null)
|
||||
.withStatic("updateCustomDecoration", "sun.awt.windows.WFramePeer").build();
|
||||
void updateCustomDecoration(ComponentPeer peer);
|
||||
}
|
||||
|
||||
private interface MacOS {
|
||||
MacOS INSTANCE = (MacOS) JBRApi.internalServiceBuilder(MethodHandles.lookup())
|
||||
.withStatic("setTitleBarHeight", "setCustomDecorationTitleBarHeight", "sun.lwawt.macosx.CPlatformWindow").build();
|
||||
MacOS INSTANCE = (MacOS) JBRApi.internalServiceBuilder(MethodHandles.lookup(), null)
|
||||
.withStatic("setTitleBarHeight", "sun.lwawt.macosx.CPlatformWindow", "setCustomDecorationTitleBarHeight").build();
|
||||
void setTitleBarHeight(Window target, ComponentPeer peer, float height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,6 +464,10 @@ public final class AWTAccessor {
|
||||
* Return the current focus cycle root
|
||||
*/
|
||||
Container getCurrentFocusCycleRoot();
|
||||
|
||||
void enqueueKeyEvents(Component untilFocused);
|
||||
|
||||
void dequeueKeyEvents(Component untilFocused);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1064,7 +1064,7 @@ abstract class CMap {
|
||||
|
||||
public static final NullCMapClass theNullCmap = new NullCMapClass();
|
||||
|
||||
static int getControlCodeGlyph(int charCode, boolean noSurrogates) {
|
||||
final int getControlCodeGlyph(int charCode, boolean noSurrogates) {
|
||||
if (charCode < 0x0010) {
|
||||
switch (charCode) {
|
||||
case 0x0009:
|
||||
@@ -1077,7 +1077,7 @@ abstract class CMap {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static char getFormatCharGlyph(int charCode) {
|
||||
final char getFormatCharGlyph(int charCode) {
|
||||
if (charCode >= 0x200c) {
|
||||
if ((charCode <= 0x200f) ||
|
||||
(charCode >= 0x2028 && charCode <= 0x202e) ||
|
||||
@@ -1144,17 +1144,15 @@ abstract class CMap {
|
||||
}
|
||||
}
|
||||
|
||||
private int findVariationSelectorIndex(int variationSelector) {
|
||||
static final int VS_NOGLYPH = 0;
|
||||
private int getGlyph(int charCode, int variationSelector) {
|
||||
int targetSelector = -1;
|
||||
for (int i = 0; i < numSelectors; i++) {
|
||||
if (selector[i] == variationSelector) {
|
||||
return i;
|
||||
targetSelector = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static final int VS_NOGLYPH = 0;
|
||||
private int getGlyph(int charCode, int targetSelector) {
|
||||
if (targetSelector == -1) {
|
||||
return VS_NOGLYPH;
|
||||
}
|
||||
@@ -1170,17 +1168,15 @@ abstract class CMap {
|
||||
}
|
||||
|
||||
char getVariationGlyph(int charCode, int variationSelector) {
|
||||
if (variationSelector == 0) return getGlyph(charCode);
|
||||
char glyph = 0;
|
||||
if (uvs != null) {
|
||||
int targetSelector = uvs.findVariationSelectorIndex(variationSelector);
|
||||
if (targetSelector != -1) {
|
||||
int result = uvs.getGlyph(charCode, targetSelector);
|
||||
if (result > 0) {
|
||||
glyph = (char)(result & 0xFFFF);
|
||||
} else {
|
||||
glyph = getGlyph(charCode);
|
||||
}
|
||||
if (uvs == null) {
|
||||
glyph = getGlyph(charCode);
|
||||
} else {
|
||||
int result = uvs.getGlyph(charCode, variationSelector);
|
||||
if (result > 0) {
|
||||
glyph = (char)(result & 0xFFFF);
|
||||
} else {
|
||||
glyph = getGlyph(charCode);
|
||||
}
|
||||
}
|
||||
return glyph;
|
||||
|
||||
@@ -109,18 +109,14 @@ public class CompositeGlyphMapper extends CharToGlyphMapper {
|
||||
}
|
||||
|
||||
protected int convertToGlyph(int unicode) {
|
||||
return convertToGlyph(unicode, 0);
|
||||
}
|
||||
|
||||
protected int convertToGlyph(int unicode, int variationSelector) {
|
||||
|
||||
for (int slot = 0; slot < font.numSlots; slot++) {
|
||||
if (!hasExcludes || !font.isExcludedChar(slot, unicode)) {
|
||||
CharToGlyphMapper mapper = getSlotMapper(slot);
|
||||
int glyphCode = mapper.charToVariationGlyph(unicode, variationSelector);
|
||||
int glyphCode = mapper.charToGlyph(unicode);
|
||||
if (glyphCode != mapper.getMissingGlyphCode()) {
|
||||
glyphCode = compositeGlyphCode(slot, glyphCode);
|
||||
if (variationSelector == 0) setCachedGlyphCode(unicode, glyphCode);
|
||||
setCachedGlyphCode(unicode, glyphCode);
|
||||
return glyphCode;
|
||||
}
|
||||
}
|
||||
@@ -128,28 +124,6 @@ public class CompositeGlyphMapper extends CharToGlyphMapper {
|
||||
return missingGlyph;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int charToVariationGlyph(int unicode, int variationSelector) {
|
||||
if (variationSelector == 0) return charToGlyph(unicode);
|
||||
else {
|
||||
int glyph = convertToGlyph(unicode, variationSelector);
|
||||
// Glyph variation not found, fallback to base glyph.
|
||||
// In fallback from variation glyph we ignore excluded chars,
|
||||
// this is needed for proper display of monochrome emoji (\ufe0e)
|
||||
if (glyph == missingGlyph) {
|
||||
for (int slot = 0; slot < font.numSlots; slot++) {
|
||||
CharToGlyphMapper mapper = getSlotMapper(slot);
|
||||
glyph = mapper.charToGlyph(unicode);
|
||||
if (glyph != mapper.getMissingGlyphCode()) {
|
||||
glyph = compositeGlyphCode(slot, glyph);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return glyph;
|
||||
}
|
||||
}
|
||||
|
||||
public int getNumGlyphs() {
|
||||
int numGlyphs = 0;
|
||||
/* The number of glyphs in a composite is affected by
|
||||
|
||||
@@ -214,9 +214,4 @@ public final class CompositeStrike extends FontStrike {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
GlyphRenderData getGlyphRenderData(int glyphCode, float x, float y) {
|
||||
PhysicalStrike strike = getStrikeForGlyph(glyphCode);
|
||||
return strike.getGlyphRenderData(glyphCode & SLOTMASK, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,16 +234,6 @@ public abstract class FileFont extends PhysicalFont {
|
||||
}
|
||||
}
|
||||
|
||||
public GlyphRenderData getGlyphRenderData(long pScalerContext, int glyphCode,
|
||||
float x, float y) {
|
||||
try {
|
||||
return getScaler().getGlyphRenderData(pScalerContext, glyphCode, x, y);
|
||||
} catch (FontScalerException fe) {
|
||||
scaler = FontScaler.getNullScaler();
|
||||
return getGlyphRenderData(pScalerContext, glyphCode, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
/* T1 & TT implementation differ so this method is abstract.
|
||||
NB: null should not be returned here! */
|
||||
protected abstract FontScaler getScaler();
|
||||
|
||||
@@ -1038,36 +1038,6 @@ public class FileFontStrike extends PhysicalStrike {
|
||||
glyphs, glyphs.length, x, y);
|
||||
}
|
||||
|
||||
private
|
||||
WeakReference<ConcurrentHashMap<Integer, GlyphRenderData>> glyphRenderDataMapRef;
|
||||
|
||||
GlyphRenderData getGlyphRenderData(int glyphCode, float x, float y) {
|
||||
|
||||
GlyphRenderData grd = null;
|
||||
ConcurrentHashMap<Integer, GlyphRenderData> glyphRenderDataMap = null;
|
||||
|
||||
if (glyphRenderDataMapRef != null) {
|
||||
glyphRenderDataMap = glyphRenderDataMapRef.get();
|
||||
if (glyphRenderDataMap != null) {
|
||||
grd = glyphRenderDataMap.get(glyphCode);
|
||||
}
|
||||
}
|
||||
|
||||
if (grd == null) {
|
||||
grd = fileFont.getGlyphRenderData(pScalerContext, glyphCode, 0, 0);
|
||||
if (glyphRenderDataMap == null) {
|
||||
glyphRenderDataMap = new ConcurrentHashMap<>();
|
||||
glyphRenderDataMapRef = new WeakReference<>(glyphRenderDataMap);
|
||||
}
|
||||
glyphRenderDataMap.put(glyphCode, grd);
|
||||
}
|
||||
grd = new GlyphRenderData(grd); // mutable!
|
||||
if (x != 0f || y != 0f) {
|
||||
grd.transform(AffineTransform.getTranslateInstance(x, y));
|
||||
}
|
||||
return grd;
|
||||
}
|
||||
|
||||
protected void adjustPoint(Point2D.Float pt) {
|
||||
if (invertDevTx != null) {
|
||||
invertDevTx.deltaTransform(pt, pt);
|
||||
|
||||
@@ -118,34 +118,14 @@ public final class FontRunIterator {
|
||||
}
|
||||
|
||||
int ch = nextCodePoint(lim);
|
||||
int nch = nextCodePoint(lim);
|
||||
int vs = CharToGlyphMapper.isVariationSelector(nch) ? nch : 0;
|
||||
int sl = mapper.charToVariationGlyph(ch, vs) & CompositeGlyphMapper.SLOTMASK;
|
||||
int sl = mapper.charToGlyph(ch) & CompositeGlyphMapper.SLOTMASK;
|
||||
slot = sl >>> 24;
|
||||
do {
|
||||
if (vs == 0) {
|
||||
ch = nch;
|
||||
} else {
|
||||
ch = nextCodePoint(lim);
|
||||
}
|
||||
nch = nextCodePoint(lim);
|
||||
vs = CharToGlyphMapper.isVariationSelector(nch) ? nch : 0;
|
||||
} while(ch != DONE && isSameRun(ch, vs, sl));
|
||||
pushback(nch);
|
||||
while ((ch = nextCodePoint(lim)) != DONE && (mapper.charToGlyph(ch) & CompositeGlyphMapper.SLOTMASK) == sl);
|
||||
pushback(ch);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isSameRun(int ch, int variationSelector, int currentSlot) {
|
||||
// Every font is meant to be able to render format chars
|
||||
// So we make format chars stick to the current font run
|
||||
if (CMap.getFormatCharGlyph(ch) == CharToGlyphMapper.INVISIBLE_GLYPH_ID) {
|
||||
return true;
|
||||
}
|
||||
return (mapper.charToVariationGlyph(ch, variationSelector) & CompositeGlyphMapper.SLOTMASK) == currentSlot;
|
||||
}
|
||||
|
||||
public boolean next() {
|
||||
return next(Script.COMMON, limit);
|
||||
}
|
||||
|
||||
@@ -168,10 +168,6 @@ public abstract class FontScaler implements DisposerRecord {
|
||||
int numGlyphs, float x, float y)
|
||||
throws FontScalerException;
|
||||
|
||||
abstract GlyphRenderData getGlyphRenderData(long pScalerContext, int glyphCode,
|
||||
float x, float y)
|
||||
throws FontScalerException;
|
||||
|
||||
/* Used by Java2D disposer to ensure native resources are released.
|
||||
Note: this method does not release any of created
|
||||
scaler context objects! */
|
||||
|
||||
@@ -76,6 +76,5 @@ public abstract class FontStrike {
|
||||
abstract GeneralPath
|
||||
getGlyphVectorOutline(int[] glyphs, float x, float y);
|
||||
|
||||
abstract GlyphRenderData getGlyphRenderData(int glyphCode, float x, float y);
|
||||
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public final class FontUtilities {
|
||||
* where the caller interprets 'layout' to mean any case where
|
||||
* one 'char' (ie the java type char) does not map to one glyph
|
||||
*/
|
||||
public static final int MAX_LAYOUT_CHARCODE = CharToGlyphMapper.VSS_END;
|
||||
public static final int MAX_LAYOUT_CHARCODE = 0x20F0;
|
||||
|
||||
/**
|
||||
* Calls the private getFont2D() method in java.awt.Font objects.
|
||||
@@ -322,19 +322,7 @@ public final class FontUtilities {
|
||||
else if (code >= 0x206a && code <= 0x206f) { // directional control
|
||||
return true;
|
||||
}
|
||||
else if (code >= 0x20d0 && code <= 0x20f0) { // U+20D0 - U+20F0 combining diacritical marks for symbols
|
||||
return true;
|
||||
}
|
||||
else if (code >= 0x1f1e6 && code <= 0x1f1ff) { // U+1F1E6 - U+1F1FF flag letters https://emojipedia.org/emoji-flag-sequence/
|
||||
return true;
|
||||
}
|
||||
else if (code == 0x1f3f4) { // black flag https://emojipedia.org/emoji-tag-sequence/
|
||||
return true;
|
||||
}
|
||||
else if (code >= 0x1f3fb && code <= 0x1f3ff) { // U+1F3FB - U+1F3FF emoji modifiers
|
||||
return true;
|
||||
}
|
||||
else if (CharToGlyphMapper.isVariationSelector(code)) {
|
||||
else if (code >= 0x20d0) { // U+20D0 - U+20F0 combining diacritical marks for symbols
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -194,21 +194,6 @@ class FreetypeFontScaler extends FontScaler {
|
||||
.getNullScaler().getGlyphVectorOutline(0L, glyphs, numGlyphs, x, y);
|
||||
}
|
||||
|
||||
synchronized GlyphRenderData getGlyphRenderData(long pScalerContext, int glyphCode,
|
||||
float x, float y) throws FontScalerException {
|
||||
if (nativeScaler != 0L) {
|
||||
GlyphRenderData result = new GlyphRenderData();
|
||||
getGlyphRenderDataNative(font.get(),
|
||||
pScalerContext,
|
||||
nativeScaler,
|
||||
glyphCode,
|
||||
x, y, result);
|
||||
return result;
|
||||
}
|
||||
return FontScaler.getNullScaler().
|
||||
getGlyphRenderData(0L, glyphCode, x,y);
|
||||
}
|
||||
|
||||
/* This method should not be called directly, in case
|
||||
* it is being invoked from a thread with a native context.
|
||||
*/
|
||||
@@ -299,9 +284,6 @@ class FreetypeFontScaler extends FontScaler {
|
||||
private native GeneralPath getGlyphVectorOutlineNative(Font2D font,
|
||||
long pScalerContext, long pScaler,
|
||||
int[] glyphs, int numGlyphs, float x, float y);
|
||||
private native void getGlyphRenderDataNative(Font2D font, long pScalerContext,
|
||||
long pScaler, int glyphCode,
|
||||
float x, float y, GlyphRenderData result);
|
||||
private native Point2D.Float getGlyphPointNative(Font2D font,
|
||||
long pScalerContext, long pScaler, int glyphCode, int ptNumber);
|
||||
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2022 JetBrains s.r.o.
|
||||
* 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.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.font;
|
||||
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.color.ColorSpace;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.GeneralPath;
|
||||
import java.awt.image.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Data for rendering any number of glyphs bypassing glyph cache.
|
||||
*/
|
||||
public class GlyphRenderData {
|
||||
|
||||
public GeneralPath outline;
|
||||
public List<ColorLayer> colorLayers;
|
||||
public List<Bitmap> bitmaps;
|
||||
|
||||
public GlyphRenderData() {}
|
||||
public GlyphRenderData(GlyphRenderData i) {
|
||||
if (i.outline != null) outline = (GeneralPath) i.outline.clone();
|
||||
if (i.colorLayers != null) {
|
||||
colorLayers = new ArrayList<>(i.colorLayers.size());
|
||||
for (ColorLayer l : i.colorLayers) {
|
||||
colorLayers.add(new ColorLayer(l.color, (GeneralPath) l.outline.clone()));
|
||||
}
|
||||
}
|
||||
if (i.bitmaps != null) {
|
||||
bitmaps = new ArrayList<>(i.bitmaps.size());
|
||||
for (Bitmap b : i.bitmaps) {
|
||||
bitmaps.add(new Bitmap(new AffineTransform(b.transform), b.image));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i must not be used afterwards
|
||||
*/
|
||||
public void merge(GlyphRenderData i) {
|
||||
if (i.outline != null) {
|
||||
if (outline == null) outline = i.outline;
|
||||
else outline.append(i.outline.getPathIterator(null), false);
|
||||
}
|
||||
if (i.colorLayers != null) {
|
||||
if (colorLayers == null) colorLayers = i.colorLayers;
|
||||
else colorLayers.addAll(i.colorLayers);
|
||||
}
|
||||
if (i.bitmaps != null) {
|
||||
if (bitmaps == null) bitmaps = i.bitmaps;
|
||||
else bitmaps.addAll(i.bitmaps);
|
||||
}
|
||||
}
|
||||
|
||||
public void transform(AffineTransform transform) {
|
||||
if (outline != null) outline.transform(transform);
|
||||
if (colorLayers != null) {
|
||||
for (ColorLayer layer : colorLayers) {
|
||||
layer.outline.transform(transform);
|
||||
}
|
||||
}
|
||||
if (bitmaps != null) {
|
||||
for (Bitmap bitmap : bitmaps) {
|
||||
bitmap.transform.preConcatenate(transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void draw(Graphics2D g) {
|
||||
if (outline != null) g.fill(outline);
|
||||
if (colorLayers != null) {
|
||||
Color color = g.getColor();
|
||||
for (ColorLayer layer : colorLayers) {
|
||||
g.setColor(layer.color == null ? color : layer.color);
|
||||
g.fill(layer.outline);
|
||||
}
|
||||
g.setColor(color);
|
||||
}
|
||||
if (bitmaps != null) {
|
||||
for (Bitmap bitmap : bitmaps) {
|
||||
g.drawImage(bitmap.image, bitmap.transform, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public record ColorLayer(Color color, GeneralPath outline) {}
|
||||
|
||||
public record Bitmap(AffineTransform transform, Image image) {}
|
||||
|
||||
// These methods exist for convenience and are called from native
|
||||
|
||||
private void setColorLayersList(int capacity) {
|
||||
colorLayers = new ArrayList<>(capacity);
|
||||
}
|
||||
|
||||
private void addColorLayers(GeneralPath outline) {
|
||||
colorLayers.add(new ColorLayer(null, outline));
|
||||
}
|
||||
|
||||
private void addColorLayers(int r, int g, int b, int a, GeneralPath outline) {
|
||||
colorLayers.add(new ColorLayer(new Color(r, g, b, a), outline));
|
||||
}
|
||||
|
||||
private static DirectColorModel colorModel(boolean premultiplied, int bits, int r, int g, int b, int a) {
|
||||
if (Unsafe.getUnsafe().isBigEndian()) {
|
||||
r = Integer.reverse(r) >>> (32 - bits);
|
||||
g = Integer.reverse(g) >>> (32 - bits);
|
||||
b = Integer.reverse(b) >>> (32 - bits);
|
||||
a = Integer.reverse(a) >>> (32 - bits);
|
||||
}
|
||||
return new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
|
||||
bits, r, g, b, a, premultiplied, DataBuffer.TYPE_INT);
|
||||
}
|
||||
private static final DirectColorModel[] BITMAP_COLOR_MODELS = {
|
||||
colorModel(false, 32, // macOS RGBA
|
||||
0x000000ff,
|
||||
0x0000ff00,
|
||||
0x00ff0000,
|
||||
0xff000000),
|
||||
colorModel(false, 32, // macOS ARGB
|
||||
0x0000ff00,
|
||||
0x00ff0000,
|
||||
0xff000000,
|
||||
0x000000ff),
|
||||
colorModel(true, 32, // Freetype BGRA
|
||||
0x00ff0000,
|
||||
0x0000ff00,
|
||||
0x000000ff,
|
||||
0xff000000)
|
||||
};
|
||||
private void addBitmap(double m00, double m10,
|
||||
double m01, double m11,
|
||||
double m02, double m12,
|
||||
int width, int height, int pitch,
|
||||
int colorModel, int[] data) {
|
||||
if (bitmaps == null) bitmaps = new ArrayList<>();
|
||||
DirectColorModel color = BITMAP_COLOR_MODELS[colorModel];
|
||||
DataBuffer buffer = new DataBufferInt(data, data.length);
|
||||
WritableRaster raster = Raster.createPackedRaster(buffer, width, height, pitch, color.getMasks(), null);
|
||||
BufferedImage image = new BufferedImage(color, raster, color.isAlphaPremultiplied(), null);
|
||||
bitmaps.add(new Bitmap(new AffineTransform(m00, m10, m01, m11, m02, m12), image));
|
||||
}
|
||||
}
|
||||
@@ -64,11 +64,6 @@ class NullFontScaler extends FontScaler {
|
||||
return new GeneralPath();
|
||||
}
|
||||
|
||||
GlyphRenderData getGlyphRenderData(long pScalerContext, int glyphCode,
|
||||
float x, float y) {
|
||||
return new GlyphRenderData();
|
||||
}
|
||||
|
||||
long createScalerContext(double[] matrix, int aa,
|
||||
int fm, float boldness, float italic) {
|
||||
return getNullScalerContext();
|
||||
|
||||
@@ -876,21 +876,6 @@ public class StandardGlyphVector extends GlyphVector {
|
||||
return result;
|
||||
}
|
||||
|
||||
public GlyphRenderData getGlyphRenderData(float x, float y) {
|
||||
setFRCTX();
|
||||
initPositions();
|
||||
|
||||
GlyphRenderData result = new GlyphRenderData();
|
||||
for (int i = 0, n = 0; i < glyphs.length; ++i, n += 2) {
|
||||
float px = x + positions[n];
|
||||
float py = y + positions[n+1];
|
||||
|
||||
getGlyphStrike(i).appendGlyphRenderData(glyphs[i], result, px, py);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
// StandardGlyphVector package private methods
|
||||
/////////////////////
|
||||
@@ -1840,19 +1825,6 @@ public class StandardGlyphVector extends GlyphVector {
|
||||
PathIterator iterator = gp.getPathIterator(null);
|
||||
result.append(iterator, false);
|
||||
}
|
||||
|
||||
void appendGlyphRenderData(int glyphID, GlyphRenderData result, float x, float y) {
|
||||
// !!! fontStrike needs a method for this. For that matter, GeneralPath does.
|
||||
GlyphRenderData grd;
|
||||
if (sgv.invdtx == null) {
|
||||
grd = strike.getGlyphRenderData(glyphID, x + dx, y + dy);
|
||||
} else {
|
||||
grd = strike.getGlyphRenderData(glyphID, 0, 0);
|
||||
grd.transform(sgv.invdtx);
|
||||
grd.transform(AffineTransform.getTranslateInstance(x + dx, y + dy));
|
||||
}
|
||||
result.merge(grd);
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
@@ -366,10 +366,10 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
jreFontMap.put("JetBrainsMono-Thin.ttf", new BundledFontInfo("JetBrainsMono-Thin", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-ThinItalic.ttf", new BundledFontInfo("JetBrainsMono-ThinItalic", 2, 225, 0));
|
||||
|
||||
jreFontMap.put("Inter-SemiBold.otf", new BundledFontInfo("Inter-SemiBold", 3, 19, 0));
|
||||
jreFontMap.put("Inter-Bold.otf", new BundledFontInfo("Inter-Bold", 3, 19, 0));
|
||||
jreFontMap.put("Inter-Regular.otf", new BundledFontInfo("Inter-Regular", 3, 19, 0));
|
||||
jreFontMap.put("Inter-Italic.otf", new BundledFontInfo("Inter-Italic", 3, 19, 0));
|
||||
jreFontMap.put("Inter-SemiBoldItalic.otf", new BundledFontInfo("Inter-SemiBoldItalic", 3, 19, 0));
|
||||
jreFontMap.put("Inter-BoldItalic.otf", new BundledFontInfo("Inter-BoldItalic", 3, 19, 0));
|
||||
|
||||
jreBundledFontFiles.addAll(jreFontMap.keySet());
|
||||
}
|
||||
|
||||
@@ -28,13 +28,12 @@ package sun.java2d.pipe;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import java.awt.font.GlyphVector;
|
||||
import java.awt.font.TextLayout;
|
||||
|
||||
import sun.font.GlyphRenderData;
|
||||
import sun.font.StandardGlyphVector;
|
||||
import sun.java2d.SunGraphics2D;
|
||||
import sun.awt.SunHints;
|
||||
|
||||
import java.awt.geom.GeneralPath;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.font.TextLayout;
|
||||
|
||||
/**
|
||||
* A delegate pipe of SG2D for drawing "large" text with
|
||||
@@ -79,22 +78,36 @@ public class OutlineTextRenderer implements TextPipe {
|
||||
}
|
||||
TextLayout tl = new TextLayout(str, g2d.getFont(),
|
||||
g2d.getFontRenderContext());
|
||||
Shape s = tl.getOutline(AffineTransform.getTranslateInstance(x, y));
|
||||
|
||||
// This will end up calling our drawGlyphVector
|
||||
tl.draw(g2d, (float) x, (float) y);
|
||||
int textAAHint = g2d.getFontInfo().aaHint;
|
||||
|
||||
int prevaaHint = - 1;
|
||||
if (textAAHint != SunHints.INTVAL_TEXT_ANTIALIAS_OFF &&
|
||||
g2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) {
|
||||
prevaaHint = g2d.antialiasHint;
|
||||
g2d.antialiasHint = SunHints.INTVAL_ANTIALIAS_ON;
|
||||
g2d.validatePipe();
|
||||
} else if (textAAHint == SunHints.INTVAL_TEXT_ANTIALIAS_OFF
|
||||
&& g2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_OFF) {
|
||||
prevaaHint = g2d.antialiasHint;
|
||||
g2d.antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF;
|
||||
g2d.validatePipe();
|
||||
}
|
||||
|
||||
g2d.fill(s);
|
||||
|
||||
if (prevaaHint != -1) {
|
||||
g2d.antialiasHint = prevaaHint;
|
||||
g2d.validatePipe();
|
||||
}
|
||||
}
|
||||
|
||||
public void drawGlyphVector(SunGraphics2D g2d, GlyphVector gv,
|
||||
float x, float y) {
|
||||
|
||||
GlyphRenderData grd;
|
||||
if (gv instanceof StandardGlyphVector) {
|
||||
grd = ((StandardGlyphVector) gv).getGlyphRenderData(x, y);
|
||||
} else {
|
||||
grd = new GlyphRenderData();
|
||||
grd.outline = new GeneralPath(gv.getOutline(x, y));
|
||||
}
|
||||
|
||||
Shape s = gv.getOutline(x, y);
|
||||
int prevaaHint = - 1;
|
||||
FontRenderContext frc = gv.getFontRenderContext();
|
||||
boolean aa = frc.isAntiAliased();
|
||||
@@ -121,7 +134,7 @@ public class OutlineTextRenderer implements TextPipe {
|
||||
g2d.validatePipe();
|
||||
}
|
||||
|
||||
grd.draw(g2d);
|
||||
g2d.fill(s);
|
||||
|
||||
if (prevaaHint != -1) {
|
||||
g2d.antialiasHint = prevaaHint;
|
||||
|
||||
BIN
src/java.desktop/share/fonts/Inter-Bold.otf
Normal file
BIN
src/java.desktop/share/fonts/Inter-Bold.otf
Normal file
Binary file not shown.
BIN
src/java.desktop/share/fonts/Inter-BoldItalic.otf
Normal file
BIN
src/java.desktop/share/fonts/Inter-BoldItalic.otf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -80,12 +80,6 @@ typedef struct FontManagerNativeIDs {
|
||||
/* sun/font/GlyphList */
|
||||
jfieldID glyphListX, glyphListY, glyphListLen,
|
||||
glyphImages, glyphListUsePos, glyphListPos, lcdRGBOrder, lcdSubPixPos;
|
||||
|
||||
/* sun/font/GlyphRenderData */
|
||||
jfieldID glyphRenderDataOutline, glyphRenderDataColorLayers;
|
||||
jmethodID glyphRenderDataSetColorLayersListMID,
|
||||
glyphRenderDataAddColorLayerMID, glyphRenderDataAddColorLayerFGMID,
|
||||
glyphRenderDataAddBitmapMID;
|
||||
} FontManagerNativeIDs;
|
||||
|
||||
/* Note: we share variable in the context of fontmanager lib
|
||||
|
||||
@@ -56,16 +56,6 @@
|
||||
#include FT_MODULE_H
|
||||
#include FT_LCD_FILTER_H
|
||||
|
||||
// Linux is built with system Freetype by default,
|
||||
// and it's often a bit old and doesn't have FT_COLOR_H.
|
||||
// Thus, we disable colored outlines on Linux to be able
|
||||
// to build on older Linuxes, this is not a big problem,
|
||||
// as Linux uses bitmap emoji anyway.
|
||||
#if defined(_WIN32) || defined(MACOSX)
|
||||
#include FT_COLOR_H
|
||||
#define ENABLE_COLOR_OUTLINES
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
/* Use bundled fontconfig.h for now */
|
||||
#include "fontconfig.h"
|
||||
@@ -97,7 +87,6 @@
|
||||
#define ROUND(x) ((int) ((x<0) ? (x-0.5) : (x+0.5)))
|
||||
#define FT26Dot6ToDouble(x) ((x) / ((double) (1<<6)))
|
||||
#define FT26Dot6ToInt(x) (((int)(x)) >> 6)
|
||||
#define FT26Dot6ToIntRound(x) (((int)(x + (1 << 5))) >> 6)
|
||||
#define FT26Dot6ToIntCeil(x) (((int)(x - 1 + (1 << 6))) >> 6)
|
||||
#define IntToFT26Dot6(x) (((FT_Fixed)(x)) << 6)
|
||||
#define DEFAULT_DPI 72
|
||||
@@ -139,12 +128,6 @@ typedef struct CachedMatch {
|
||||
#define NUM_CACHED_VALUES 8
|
||||
#endif
|
||||
|
||||
// Define these manually when building with old Freetype (before 2.5)
|
||||
#if !defined(FT_LOAD_COLOR)
|
||||
#define FT_LOAD_COLOR ( 1L << 20 )
|
||||
#define FT_PIXEL_MODE_BGRA 7
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
/* Important note:
|
||||
JNI forbids sharing same env between different threads.
|
||||
@@ -633,7 +616,7 @@ static void setInterpreterVersion(FT_Library library) {
|
||||
((FT_MulFix(units_per_EM, y_scale) / BOLD_DIVISOR ))
|
||||
|
||||
#define BOLD_MODIFIER(units_per_EM, y_scale) \
|
||||
((context->doBold && !context->colorFont) ? BOLD_FACTOR(units_per_EM, y_scale) : 0)
|
||||
(context->doBold ? BOLD_FACTOR(units_per_EM, y_scale) : 0)
|
||||
|
||||
static void GlyphSlot_Embolden(FT_GlyphSlot slot, FT_Matrix transform) {
|
||||
FT_Pos extra = 0;
|
||||
@@ -895,7 +878,7 @@ static void setupLoadRenderFlags(FTScalerContext *context, int fcHintStyle, FcBo
|
||||
|
||||
static void setupTransform(FT_Matrix* target, FTScalerContext *context) {
|
||||
FT_Matrix* transform = &context->transform;
|
||||
if (context->doItalize && !context->colorFont) {
|
||||
if (context->doItalize) {
|
||||
// we cannot use FT_GlyphSlot_Oblique as it doesn't work well with arbitrary transforms,
|
||||
// so we add corresponding shear transform to the requested glyph transformation
|
||||
target->xx = FT_MATRIX_ONE;
|
||||
@@ -936,18 +919,18 @@ static int setupFTContext(JNIEnv *env, jobject font2D, FTScalerInfo *scalerInfo,
|
||||
scalerInfo->font2D = font2D;
|
||||
|
||||
if (context != NULL) {
|
||||
context->colorFont = FT_HAS_COLOR(scalerInfo->face) || !FT_IS_SCALABLE(scalerInfo->face);
|
||||
|
||||
setupTransform(&matrix, context);
|
||||
FT_Set_Transform(scalerInfo->face, &matrix, NULL);
|
||||
FT_UInt dpi = (FT_UInt) getScreenResolution(env);
|
||||
|
||||
if (FT_IS_SCALABLE(scalerInfo->face)) { // Standard scalable face
|
||||
context->colorFont = FT_HAS_COLOR(scalerInfo->face) ? TRUE : FALSE;
|
||||
context->fixedSizeIndex = -1;
|
||||
errCode = FT_Set_Char_Size(scalerInfo->face, 0,
|
||||
ADJUST_FONT_SIZE(context->ptsz, dpi),
|
||||
dpi, dpi);
|
||||
} else { // Non-scalable face (that should only be bitmap faces)
|
||||
context->colorFont = TRUE;
|
||||
const int ptsz = context->ptsz;
|
||||
// Best size is smallest, but not smaller than requested
|
||||
int bestSizeIndex = 0;
|
||||
@@ -1217,8 +1200,7 @@ static int setupFTContext(JNIEnv *env, jobject font2D, FTScalerInfo *scalerInfo,
|
||||
}
|
||||
|
||||
// using same values as for the transformation matrix
|
||||
#define OBLIQUE_MODIFIER(y) \
|
||||
((context->doItalize && !context->colorFont) ? ((y)*FT_MATRIX_OBLIQUE_XY/FT_MATRIX_ONE) : 0)
|
||||
#define OBLIQUE_MODIFIER(y) (context->doItalize ? ((y)*FT_MATRIX_OBLIQUE_XY/FT_MATRIX_ONE) : 0)
|
||||
|
||||
/*
|
||||
* Class: sun_font_FreetypeFontScaler
|
||||
@@ -1367,7 +1349,7 @@ static jlong
|
||||
getGlyphImageNativeInternal(
|
||||
JNIEnv *env, jobject scaler, jobject font2D,
|
||||
jlong pScalerContext, jlong pScaler, jint glyphCode,
|
||||
jboolean renderImage, jboolean setupContext);
|
||||
jboolean renderImage);
|
||||
|
||||
/*
|
||||
* Class: sun_font_FreetypeFontScaler
|
||||
@@ -1396,7 +1378,7 @@ Java_sun_font_FreetypeFontScaler_getGlyphAdvanceNative(
|
||||
jlong image;
|
||||
|
||||
image = getGlyphImageNativeInternal(
|
||||
env, scaler, font2D, pScalerContext, pScaler, glyphCode, JNI_FALSE, JNI_TRUE);
|
||||
env, scaler, font2D, pScalerContext, pScaler, glyphCode, JNI_FALSE);
|
||||
info = (GlyphInfo*) jlong_to_ptr(image);
|
||||
|
||||
if (info != NULL) {
|
||||
@@ -1422,7 +1404,7 @@ Java_sun_font_FreetypeFontScaler_getGlyphMetricsNative(
|
||||
|
||||
jlong image = getGlyphImageNativeInternal(
|
||||
env, scaler, font2D,
|
||||
pScalerContext, pScaler, glyphCode, JNI_FALSE, JNI_TRUE);
|
||||
pScalerContext, pScaler, glyphCode, JNI_FALSE);
|
||||
info = (GlyphInfo*) jlong_to_ptr(image);
|
||||
|
||||
if (info != NULL) {
|
||||
@@ -1732,14 +1714,14 @@ Java_sun_font_FreetypeFontScaler_getGlyphImageNative(
|
||||
|
||||
return getGlyphImageNativeInternal(
|
||||
env, scaler, font2D,
|
||||
pScalerContext, pScaler, glyphCode, JNI_TRUE, JNI_TRUE);
|
||||
pScalerContext, pScaler, glyphCode, JNI_TRUE);
|
||||
}
|
||||
|
||||
static jlong
|
||||
getGlyphImageNativeInternal(
|
||||
JNIEnv *env, jobject scaler, jobject font2D,
|
||||
jlong pScalerContext, jlong pScaler, jint glyphCode,
|
||||
jboolean renderImage, jboolean setupContext) {
|
||||
jboolean renderImage) {
|
||||
|
||||
static int PADBYTES = 3;
|
||||
int error, imageSize;
|
||||
@@ -1789,13 +1771,11 @@ static jlong
|
||||
((double)context->ptsz)/64.0);
|
||||
}
|
||||
|
||||
if (setupContext) {
|
||||
error = setupFTContext(env, font2D, scalerInfo, context, TRUE);
|
||||
if (error) {
|
||||
if (logFFS) fprintf(stderr, "FFS_LOG: Cannot setup FT context\n");
|
||||
invalidateJavaScaler(env, scaler, scalerInfo);
|
||||
return ptr_to_jlong(getNullGlyphImage());
|
||||
}
|
||||
error = setupFTContext(env, font2D, scalerInfo, context, TRUE);
|
||||
if (error) {
|
||||
if (logFFS) fprintf(stderr, "FFS_LOG: Cannot setup FT context\n");
|
||||
invalidateJavaScaler(env, scaler, scalerInfo);
|
||||
return ptr_to_jlong(getNullGlyphImage());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1962,13 +1942,13 @@ static jlong
|
||||
(float) - (advh * FTFixedToFloat(context->transform.yx));
|
||||
} else {
|
||||
if (!ftglyph->advance.y) {
|
||||
glyphInfo->advanceX = FT26Dot6ToIntRound(
|
||||
FT_MulFix(ftglyph->advance.x, manualScale));
|
||||
glyphInfo->advanceX =
|
||||
(float) ROUND(FT26Dot6ToFloat(FT_MulFix(ftglyph->advance.x, manualScale)));
|
||||
glyphInfo->advanceY = 0;
|
||||
} else if (!ftglyph->advance.x) {
|
||||
glyphInfo->advanceX = 0;
|
||||
glyphInfo->advanceY = FT26Dot6ToIntRound(
|
||||
-FT_MulFix(ftglyph->advance.y, manualScale));
|
||||
glyphInfo->advanceY =
|
||||
(float) ROUND(FT26Dot6ToFloat(-FT_MulFix(ftglyph->advance.y, manualScale)));
|
||||
} else {
|
||||
glyphInfo->advanceX = FT26Dot6ToFloat(
|
||||
FT_MulFix(ftglyph->advance.x, manualScale));
|
||||
@@ -2164,13 +2144,24 @@ Java_sun_font_FreetypeFontScaler_getGlyphCodeNative(
|
||||
|
||||
#define FloatToF26Dot6(x) ((unsigned int) ((x)*64))
|
||||
|
||||
static FT_Outline* getFTOutlineNoSetup(FTScalerContext *context, FTScalerInfo* scalerInfo,
|
||||
jint glyphCode, jfloat xpos, jfloat ypos) {
|
||||
static FT_Outline* getFTOutline(JNIEnv* env, jobject font2D,
|
||||
FTScalerContext *context, FTScalerInfo* scalerInfo,
|
||||
jint glyphCode, jfloat xpos, jfloat ypos) {
|
||||
|
||||
FT_Error error;
|
||||
FT_GlyphSlot ftglyph;
|
||||
FT_Int32 loadFlags;
|
||||
|
||||
if (glyphCode >= INVISIBLE_GLYPHS ||
|
||||
isNullScalerContext(context) || scalerInfo == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
error = setupFTContext(env, font2D, scalerInfo, context, TRUE);
|
||||
if (error) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// We cannot get an outline from bitmap version of glyph
|
||||
loadFlags = FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP;
|
||||
|
||||
@@ -2180,10 +2171,9 @@ static FT_Outline* getFTOutlineNoSetup(FTScalerContext *context, FTScalerInfo* s
|
||||
}
|
||||
|
||||
ftglyph = scalerInfo->face->glyph;
|
||||
int outlineGlyph = ftglyph->format == FT_GLYPH_FORMAT_OUTLINE;
|
||||
|
||||
/* apply styles */
|
||||
if (context->doBold && outlineGlyph && !context->colorFont) { /* if bold style */
|
||||
if (context->doBold) { /* if bold style */
|
||||
GlyphSlot_Embolden(ftglyph, context->transform);
|
||||
}
|
||||
|
||||
@@ -2194,24 +2184,6 @@ static FT_Outline* getFTOutlineNoSetup(FTScalerContext *context, FTScalerInfo* s
|
||||
return &ftglyph->outline;
|
||||
}
|
||||
|
||||
static FT_Outline* getFTOutline(JNIEnv* env, jobject font2D,
|
||||
FTScalerContext *context, FTScalerInfo* scalerInfo,
|
||||
jint glyphCode, jfloat xpos, jfloat ypos) {
|
||||
FT_Error error;
|
||||
|
||||
if (glyphCode >= INVISIBLE_GLYPHS ||
|
||||
isNullScalerContext(context) || scalerInfo == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
error = setupFTContext(env, font2D, scalerInfo, context, TRUE);
|
||||
if (error) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return getFTOutlineNoSetup(context, scalerInfo, glyphCode, xpos, ypos);
|
||||
}
|
||||
|
||||
#define F26Dot6ToFloat(n) (((float)(n))/((float) 64))
|
||||
|
||||
/* Types of GeneralPath segments.
|
||||
@@ -2368,13 +2340,19 @@ static void freeGP(GPData* gpdata) {
|
||||
}
|
||||
}
|
||||
|
||||
static jobject outlineToGeneralPath(JNIEnv* env, FT_Outline* outline) {
|
||||
static jobject getGlyphGeneralPath(JNIEnv* env, jobject font2D,
|
||||
FTScalerContext *context, FTScalerInfo *scalerInfo,
|
||||
jint glyphCode, jfloat xpos, jfloat ypos) {
|
||||
|
||||
FT_Outline* outline;
|
||||
jobject gp = NULL;
|
||||
jbyteArray types;
|
||||
jfloatArray coords;
|
||||
GPData gpdata;
|
||||
|
||||
outline = getFTOutline(env, font2D, context, scalerInfo,
|
||||
glyphCode, xpos, ypos);
|
||||
|
||||
if (outline == NULL || outline->n_points == 0) {
|
||||
return gp;
|
||||
}
|
||||
@@ -2412,75 +2390,6 @@ static jobject outlineToGeneralPath(JNIEnv* env, FT_Outline* outline) {
|
||||
return gp;
|
||||
}
|
||||
|
||||
static jboolean addColorLayersRenderData(JNIEnv* env, FTScalerContext *context,
|
||||
FTScalerInfo* scalerInfo, jint glyphCode,
|
||||
jfloat xpos, jfloat ypos, jobject result) {
|
||||
|
||||
#ifdef ENABLE_COLOR_OUTLINES
|
||||
FT_Error error;
|
||||
|
||||
FT_Color* colors;
|
||||
error = FT_Palette_Select(scalerInfo->face, 0, &colors);
|
||||
if (error) return JNI_FALSE;
|
||||
|
||||
FT_LayerIterator iterator;
|
||||
iterator.p = NULL;
|
||||
FT_UInt glyphIndex, colorIndex;
|
||||
if (!FT_Get_Color_Glyph_Layer(scalerInfo->face, glyphCode,
|
||||
&glyphIndex, &colorIndex, &iterator)) return JNI_FALSE;
|
||||
(*env)->CallVoidMethod(env, result, sunFontIDs.glyphRenderDataSetColorLayersListMID, iterator.num_layers);
|
||||
do {
|
||||
FT_Outline* outline = getFTOutlineNoSetup(context, scalerInfo, glyphIndex, xpos, ypos);
|
||||
jobject gp = outlineToGeneralPath(env, outline);
|
||||
|
||||
if (colorIndex == 0xFFFF) {
|
||||
(*env)->CallVoidMethod(env, result, sunFontIDs.glyphRenderDataAddColorLayerFGMID, gp);
|
||||
} else {
|
||||
(*env)->CallVoidMethod(env, result, sunFontIDs.glyphRenderDataAddColorLayerMID,
|
||||
colors[colorIndex].red, colors[colorIndex].green,
|
||||
colors[colorIndex].blue, colors[colorIndex].alpha, gp);
|
||||
}
|
||||
} while(FT_Get_Color_Glyph_Layer(scalerInfo->face, glyphCode,
|
||||
&glyphIndex, &colorIndex, &iterator));
|
||||
|
||||
return JNI_TRUE;
|
||||
#else
|
||||
return JNI_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void addBitmapRenderData(JNIEnv *env, jobject scaler, jobject font2D,
|
||||
FTScalerContext *context, FTScalerInfo* scalerInfo,
|
||||
jint glyphCode, jfloat xpos, jfloat ypos, jobject result) {
|
||||
GlyphInfo* glyphInfo = (GlyphInfo*) jlong_to_ptr(getGlyphImageNativeInternal(
|
||||
env, scaler, font2D,
|
||||
ptr_to_jlong(context), ptr_to_jlong(scalerInfo),
|
||||
glyphCode, JNI_FALSE, JNI_FALSE));
|
||||
|
||||
FT_GlyphSlot ftglyph = scalerInfo->face->glyph;
|
||||
|
||||
if (ftglyph->bitmap.pixel_mode != FT_PIXEL_MODE_BGRA) return;
|
||||
|
||||
int pitch = ftglyph->bitmap.pitch / 4;
|
||||
int size = pitch * ftglyph->bitmap.rows;
|
||||
jintArray array = (*env)->NewIntArray(env, size);
|
||||
(*env)->SetIntArrayRegion(env, array, 0, size, (jint*) ftglyph->bitmap.buffer);
|
||||
|
||||
double bitmapSize = (double) scalerInfo->face->available_sizes[context->fixedSizeIndex].size;
|
||||
double scale = (double) context->ptsz / bitmapSize / (double) (ftFixed1);
|
||||
double tx = ftglyph->bitmap_left + xpos * bitmapSize / (double) context->ptsz;
|
||||
double ty = -ftglyph->bitmap_top + ypos * bitmapSize / (double) context->ptsz;
|
||||
|
||||
jdouble m00 = (jdouble) context->transform.xx * scale, m10 = (jdouble) context->transform.xy * scale;
|
||||
jdouble m01 = (jdouble) context->transform.yx * scale, m11 = (jdouble) context->transform.yy * scale;
|
||||
jdouble m02 = m00 * tx + m01 * ty, m12 = m10 * tx + m11 * ty;
|
||||
|
||||
free(glyphInfo);
|
||||
(*env)->CallVoidMethod(env, result, sunFontIDs.glyphRenderDataAddBitmapMID,
|
||||
m00, m10, m01, m11, m02, m12,
|
||||
ftglyph->bitmap.width, ftglyph->bitmap.rows, pitch, 2, array);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_font_FreetypeFontScaler
|
||||
* Method: getGlyphOutlineNative
|
||||
@@ -2495,10 +2404,13 @@ Java_sun_font_FreetypeFontScaler_getGlyphOutlineNative(
|
||||
(FTScalerContext*) jlong_to_ptr(pScalerContext);
|
||||
FTScalerInfo* scalerInfo = (FTScalerInfo *) jlong_to_ptr(pScaler);
|
||||
|
||||
FT_Outline* outline = getFTOutline(env, font2D, context,
|
||||
scalerInfo, glyphCode,
|
||||
xpos, ypos);
|
||||
jobject gp = outlineToGeneralPath(env, outline);
|
||||
jobject gp = getGlyphGeneralPath(env,
|
||||
font2D,
|
||||
context,
|
||||
scalerInfo,
|
||||
glyphCode,
|
||||
xpos,
|
||||
ypos);
|
||||
if (gp == NULL) { /* can be legal */
|
||||
gp = (*env)->NewObject(env,
|
||||
sunFontIDs.gpClass,
|
||||
@@ -2646,42 +2558,6 @@ Java_sun_font_FreetypeFontScaler_getGlyphVectorOutlineNative(
|
||||
return (*env)->NewObject(env, sunFontIDs.gpClass, sunFontIDs.gpCtrEmpty);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_font_FreetypeFontScaler
|
||||
* Method: getGlyphRenderDataNative
|
||||
* Signature: (Lsun/font/Font2D;JIFFLsun/font/GlyphRenderData;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_font_FreetypeFontScaler_getGlyphRenderDataNative(
|
||||
JNIEnv *env, jobject scaler, jobject font2D, jlong pScalerContext,
|
||||
jlong pScaler, jint glyphCode, jfloat xpos, jfloat ypos, jobject result) {
|
||||
|
||||
FTScalerContext *context =
|
||||
(FTScalerContext*) jlong_to_ptr(pScalerContext);
|
||||
FTScalerInfo* scalerInfo = (FTScalerInfo *) jlong_to_ptr(pScaler);
|
||||
|
||||
if (glyphCode >= INVISIBLE_GLYPHS ||
|
||||
isNullScalerContext(context) || scalerInfo == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
FT_Error error = setupFTContext(env, font2D, scalerInfo, context, TRUE);
|
||||
if (error) return;
|
||||
|
||||
if (context->fixedSizeIndex == -1) {
|
||||
if (!context->colorFont ||
|
||||
!addColorLayersRenderData(env, context, scalerInfo, glyphCode, xpos, ypos, result)) {
|
||||
FT_Outline* outline = getFTOutlineNoSetup(context, scalerInfo, glyphCode, xpos, ypos);
|
||||
jobject gp = outlineToGeneralPath(env, outline);
|
||||
if (gp != NULL) {
|
||||
(*env)->SetObjectField(env, result, sunFontIDs.glyphRenderDataOutline, gp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addBitmapRenderData(env, scaler, font2D, context, scalerInfo, glyphCode, xpos, ypos, result);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_sun_font_FreetypeFontScaler_getUnitsPerEMNative(
|
||||
JNIEnv *env, jobject scaler, jlong pScaler) {
|
||||
|
||||
@@ -189,20 +189,6 @@ static void initFontIDs(JNIEnv *env) {
|
||||
CHECK_NULL(sunFontIDs.lcdSubPixPos =
|
||||
(*env)->GetFieldID(env, tmpClass, "lcdSubPixPos", "Z"));
|
||||
|
||||
CHECK_NULL(tmpClass = (*env)->FindClass(env, "sun/font/GlyphRenderData"));
|
||||
CHECK_NULL(sunFontIDs.glyphRenderDataOutline =
|
||||
(*env)->GetFieldID(env, tmpClass, "outline", "Ljava/awt/geom/GeneralPath;"));
|
||||
CHECK_NULL(sunFontIDs.glyphRenderDataColorLayers =
|
||||
(*env)->GetFieldID(env, tmpClass, "colorLayers", "Ljava/util/List;"));
|
||||
CHECK_NULL(sunFontIDs.glyphRenderDataSetColorLayersListMID =
|
||||
(*env)->GetMethodID(env, tmpClass, "setColorLayersList", "(I)V"));
|
||||
CHECK_NULL(sunFontIDs.glyphRenderDataAddColorLayerMID =
|
||||
(*env)->GetMethodID(env, tmpClass, "addColorLayers", "(IIIILjava/awt/geom/GeneralPath;)V"));
|
||||
CHECK_NULL(sunFontIDs.glyphRenderDataAddColorLayerFGMID =
|
||||
(*env)->GetMethodID(env, tmpClass, "addColorLayers", "(Ljava/awt/geom/GeneralPath;)V"));
|
||||
CHECK_NULL(sunFontIDs.glyphRenderDataAddBitmapMID =
|
||||
(*env)->GetMethodID(env, tmpClass, "addBitmap", "(DDDDDDIIII[I)V"));
|
||||
|
||||
initLCDGammaTables();
|
||||
|
||||
initialisedFontIDs = 1;
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* ftcolor.c
|
||||
*
|
||||
* FreeType's glyph color management (body).
|
||||
*
|
||||
* Copyright (C) 2018-2022 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
*
|
||||
* This file is part of the FreeType project, and may only be used,
|
||||
* modified, and distributed under the terms of the FreeType project
|
||||
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
* this file you indicate that you have read the license and
|
||||
* understand and accept it fully.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <freetype/internal/ftdebug.h>
|
||||
#include <freetype/internal/sfnt.h>
|
||||
#include <freetype/internal/tttypes.h>
|
||||
#include <freetype/ftcolor.h>
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
|
||||
|
||||
static
|
||||
const FT_Palette_Data null_palette_data = { 0, NULL, NULL, 0, NULL };
|
||||
|
||||
|
||||
/* documentation is in ftcolor.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Palette_Data_Get( FT_Face face,
|
||||
FT_Palette_Data *apalette_data )
|
||||
{
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
if ( !apalette_data)
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
if ( FT_IS_SFNT( face ) )
|
||||
*apalette_data = ( (TT_Face)face )->palette_data;
|
||||
else
|
||||
*apalette_data = null_palette_data;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftcolor.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Palette_Select( FT_Face face,
|
||||
FT_UShort palette_index,
|
||||
FT_Color* *apalette )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
TT_Face ttface;
|
||||
SFNT_Service sfnt;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
|
||||
if ( !FT_IS_SFNT( face ) )
|
||||
{
|
||||
if ( apalette )
|
||||
*apalette = NULL;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
ttface = (TT_Face)face;
|
||||
sfnt = (SFNT_Service)ttface->sfnt;
|
||||
|
||||
error = sfnt->set_palette( ttface, palette_index );
|
||||
if ( error )
|
||||
return error;
|
||||
|
||||
ttface->palette_index = palette_index;
|
||||
|
||||
if ( apalette )
|
||||
*apalette = ttface->palette;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftcolor.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Palette_Set_Foreground_Color( FT_Face face,
|
||||
FT_Color foreground_color )
|
||||
{
|
||||
TT_Face ttface;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
|
||||
if ( !FT_IS_SFNT( face ) )
|
||||
return FT_Err_Ok;
|
||||
|
||||
ttface = (TT_Face)face;
|
||||
|
||||
ttface->foreground_color = foreground_color;
|
||||
ttface->have_foreground_color = 1;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
#else /* !TT_CONFIG_OPTION_COLOR_LAYERS */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Palette_Data_Get( FT_Face face,
|
||||
FT_Palette_Data *apalette_data )
|
||||
{
|
||||
FT_UNUSED( face );
|
||||
FT_UNUSED( apalette_data );
|
||||
|
||||
|
||||
return FT_THROW( Unimplemented_Feature );
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Palette_Select( FT_Face face,
|
||||
FT_UShort palette_index,
|
||||
FT_Color* *apalette )
|
||||
{
|
||||
FT_UNUSED( face );
|
||||
FT_UNUSED( palette_index );
|
||||
FT_UNUSED( apalette );
|
||||
|
||||
|
||||
return FT_THROW( Unimplemented_Feature );
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Palette_Set_Foreground_Color( FT_Face face,
|
||||
FT_Color foreground_color )
|
||||
{
|
||||
FT_UNUSED( face );
|
||||
FT_UNUSED( foreground_color );
|
||||
|
||||
|
||||
return FT_THROW( Unimplemented_Feature );
|
||||
}
|
||||
|
||||
#endif /* !TT_CONFIG_OPTION_COLOR_LAYERS */
|
||||
|
||||
|
||||
/* END */
|
||||
@@ -114,7 +114,12 @@ final class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
|
||||
try {
|
||||
quit = !b;
|
||||
if (b) {
|
||||
new Thread(null, this::showNativeDialog, "ShowDialog", 0, false).start();
|
||||
Runnable task = () -> {
|
||||
showNativeDialog();
|
||||
standaloneWindow = 0;
|
||||
fd.setVisible(false);
|
||||
};
|
||||
new Thread(null, task, "ShowDialog", 0, false).start();
|
||||
} else {
|
||||
quit();
|
||||
fd.setVisible(false);
|
||||
@@ -203,13 +208,4 @@ final class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by native code when GTK dialog is closing.
|
||||
*/
|
||||
private void onClose() {
|
||||
widget = 0;
|
||||
standaloneWindow = 0;
|
||||
fd.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,21 +293,15 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
|
||||
* when a component inside a Frame is requesting focus.
|
||||
* See 6314575 for details.
|
||||
*/
|
||||
boolean res = wpeer.requestWindowFocus(null);
|
||||
|
||||
if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
|
||||
focusLog.finer("Requested window focus: " + res);
|
||||
}
|
||||
// If parent window can be made focused and has been made focused(synchronously)
|
||||
// then we can proceed with children, otherwise we retreat.
|
||||
if (!(res && parentWindow.isFocused())) {
|
||||
return rejectFocusRequestHelper("Waiting for asynchronous processing of the request");
|
||||
}
|
||||
return XKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
|
||||
target,
|
||||
temporary,
|
||||
focusedWindowChangeAllowed,
|
||||
time, cause);
|
||||
return wpeer.requestWindowFocus(null, () -> {
|
||||
XKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
|
||||
target,
|
||||
temporary,
|
||||
focusedWindowChangeAllowed,
|
||||
time, cause);
|
||||
}, () -> {
|
||||
rejectFocusRequestHelper("Waiting for asynchronous processing of the request");
|
||||
});
|
||||
// Motif compatibility code
|
||||
case XKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
|
||||
// Either lightweight or excessive request - all events are generated.
|
||||
|
||||
@@ -415,10 +415,6 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
insets_corrected = true;
|
||||
reshape(dimensions, SET_SIZE, false);
|
||||
} else if (xe.get_parent() == root) {
|
||||
if (!isReparented()) {
|
||||
// X server on Windows (e.g. Cygwin/X) does perform a no-op reparenting to the root window
|
||||
return;
|
||||
}
|
||||
configure_seen = false;
|
||||
insets_corrected = false;
|
||||
|
||||
@@ -1258,7 +1254,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
if (target == activeWindow && target != focusedWindow) {
|
||||
// Happens when an owned window is currently focused
|
||||
focusLog.fine("Focus is on child window - transferring it back to the owner");
|
||||
handleWindowFocusInSync(-1);
|
||||
handleWindowFocusInSync(-1, () -> {});
|
||||
return true;
|
||||
}
|
||||
Window realNativeFocusedWindow = XWindowPeer.getNativeFocusedWindow();
|
||||
|
||||
@@ -111,8 +111,7 @@ final class XWM
|
||||
UNITY_COMPIZ_WM = 16,
|
||||
XMONAD_WM = 17,
|
||||
AWESOME_WM = 18,
|
||||
I3_WM = 19,
|
||||
WESTON_WM = 20;
|
||||
I3_WM = 19;
|
||||
|
||||
public String toString() {
|
||||
switch (WMID) {
|
||||
@@ -152,8 +151,6 @@ final class XWM
|
||||
return "Awesome";
|
||||
case XWM.I3_WM:
|
||||
return "I3WM";
|
||||
case XWM.WESTON_WM:
|
||||
return "Weston";
|
||||
case UNDETERMINED_WM:
|
||||
default:
|
||||
return "Undetermined WM";
|
||||
@@ -631,10 +628,6 @@ final class XWM
|
||||
return isNetWMName("i3");
|
||||
}
|
||||
|
||||
static boolean isWeston() {
|
||||
return isNetWMName("Weston");
|
||||
}
|
||||
|
||||
static int awtWMNonReparenting = -1;
|
||||
static boolean isNonReparentingWM() {
|
||||
if (awtWMNonReparenting == -1) {
|
||||
@@ -840,8 +833,6 @@ final class XWM
|
||||
awt_wmgr = XWM.AWESOME_WM;
|
||||
} else if (isI3()) {
|
||||
awt_wmgr = XWM.I3_WM;
|
||||
} else if (isWeston()) {
|
||||
awt_wmgr = XWM.WESTON_WM;
|
||||
}
|
||||
/*
|
||||
* We don't check for legacy WM when we already know that WM
|
||||
|
||||
@@ -424,13 +424,14 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void sendEvent(final AWTEvent e) {
|
||||
static void sendEvent(final AWTEvent e, Runnable lightweigtRequestRunnable) {
|
||||
// The uses of this method imply that the incoming event is system-generated
|
||||
SunToolkit.setSystemGenerated(e);
|
||||
PeerEvent pe = new PeerEvent(Toolkit.getDefaultToolkit(), new Runnable() {
|
||||
public void run() {
|
||||
AWTAccessor.getAWTEventAccessor().setPosted(e);
|
||||
((Component)e.getSource()).dispatchEvent(e);
|
||||
lightweigtRequestRunnable.run();
|
||||
}
|
||||
}, PeerEvent.ULTIMATE_PRIORITY_EVENT);
|
||||
if (focusLog.isLoggable(PlatformLogger.Level.FINER) && (e instanceof FocusEvent)) {
|
||||
@@ -439,6 +440,9 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
XToolkit.postEvent(XToolkit.targetToAppContext(e.getSource()), pe);
|
||||
}
|
||||
|
||||
static void sendEvent(final AWTEvent e) {
|
||||
sendEvent(e, () -> {});
|
||||
}
|
||||
|
||||
/*
|
||||
* Post an event to the event queue.
|
||||
|
||||
@@ -618,16 +618,15 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
target.dispatchEvent(we);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleWindowFocusInSync(long serial) {
|
||||
public void handleWindowFocusInSync(long serial, Runnable lightweigtRequest) {
|
||||
WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS);
|
||||
XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow((Window) target);
|
||||
sendEvent(we);
|
||||
sendEvent(we, lightweigtRequest);
|
||||
}
|
||||
// NOTE: This method may be called by privileged threads.
|
||||
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
|
||||
public void handleWindowFocusIn(long serial) {
|
||||
handleWindowFocusInSync(serial);
|
||||
handleWindowFocusInSync(serial, () -> {});
|
||||
}
|
||||
|
||||
// NOTE: This method may be called by privileged threads.
|
||||
@@ -848,7 +847,16 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
focusLog.fine("Requesting window focus");
|
||||
}
|
||||
requestWindowFocus(time, timeProvided);
|
||||
Runnable finishRunnable = this::dequeueKeyEvents;
|
||||
requestWindowFocus(time, timeProvided, finishRunnable, finishRunnable);
|
||||
}
|
||||
|
||||
private void dequeueKeyEvents() {
|
||||
AWTAccessor.getKeyboardFocusManagerAccessor().dequeueKeyEvents(target);
|
||||
}
|
||||
|
||||
private void enqueueKeyEvents() {
|
||||
AWTAccessor.getKeyboardFocusManagerAccessor().enqueueKeyEvents(target);
|
||||
}
|
||||
|
||||
public final boolean focusAllowedFor() {
|
||||
@@ -1136,14 +1144,17 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
warningWindow.setSecurityWarningVisible(false, false);
|
||||
}
|
||||
boolean refreshChildsTransientFor = isVisible() != vis;
|
||||
// To enable type-ahead for 'simple' windows, we initiate internal focus transfer to such a window even before
|
||||
// it's mapped by a window manager. 'Simple' windows aren't natively focusable, so for this to work as expected
|
||||
// we only need to be sure that the window will be mapped soon after we request it. There are known cases when
|
||||
// window manager delays mapping the window for a long time (e.g. i3wm does this when another window is in
|
||||
// full-screen mode), but no known cases when it does it for popup windows, so we hope that we're safe here with
|
||||
// 'simple' windows.
|
||||
if (vis && isSimpleWindow() && shouldFocusOnMapNotify()) {
|
||||
requestInitialFocus();
|
||||
// We enable type-ahead mechanism only for showing of simple windows. That's because, when enabling it,
|
||||
// we need to be sure that the final state (focusing) of the target window will definitely be available
|
||||
// very soon, not to block key events for a long period of time. As simple windows are not focused natively,
|
||||
// the only event we should wait for before focusing them internally is MapNotify, and that event usually
|
||||
// comes quite fast after map request. There are known cases when window manager delays mapping the window
|
||||
// for a long time (e.g. i3wm does this when another window is in full-screen mode), but no known cases
|
||||
// when it does it for popup windows, so we hope that we're safe here with simple windows. For decorated
|
||||
// windows we also wait for the native focus to be transferred to the target window (FocusIn event),
|
||||
// which adds to the uncertainty - the focus might or might not be transferred.
|
||||
enqueueKeyEvents();
|
||||
}
|
||||
super.setVisible(vis);
|
||||
if (refreshChildsTransientFor) {
|
||||
@@ -1212,7 +1223,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
if (targetOwner != null) {
|
||||
XWindowPeer xwndpeer = AWTAccessor.getComponentAccessor().getPeer(targetOwner);
|
||||
if (xwndpeer != null) {
|
||||
xwndpeer.requestWindowFocus();
|
||||
xwndpeer.requestWindowFocus(() -> {}, () -> {});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1484,9 +1495,11 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isSimpleWindow() && shouldFocusOnMapNotify() && !XWM.isWeston()) {
|
||||
if (shouldFocusOnMapNotify()) {
|
||||
focusLog.fine("Automatically request focus on window");
|
||||
requestInitialFocus();
|
||||
} else {
|
||||
dequeueKeyEvents();
|
||||
}
|
||||
isUnhiding = false;
|
||||
isBeforeFirstMapNotify = false;
|
||||
@@ -2038,16 +2051,25 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
return window;
|
||||
}
|
||||
|
||||
public boolean requestWindowFocus(XWindowPeer actualFocusedWindow) {
|
||||
public boolean requestWindowFocus(XWindowPeer actualFocusedWindow, Runnable lightweigtRequest, Runnable rejectFocusRequest) {
|
||||
setActualFocusedWindow(actualFocusedWindow);
|
||||
return requestWindowFocus();
|
||||
return requestWindowFocus(lightweigtRequest, rejectFocusRequest);
|
||||
}
|
||||
|
||||
public boolean requestWindowFocus() {
|
||||
return requestWindowFocus(0, false);
|
||||
return requestWindowFocus(() -> {}, () -> {});
|
||||
}
|
||||
|
||||
public boolean requestWindowFocus(Runnable lightweigtRequest, Runnable rejectFocusRequest) {
|
||||
return requestWindowFocus(0, false, lightweigtRequest, rejectFocusRequest);
|
||||
}
|
||||
|
||||
public boolean requestWindowFocus(long time, boolean timeProvided) {
|
||||
return requestWindowFocus(time, timeProvided, () -> {}, () -> {});
|
||||
}
|
||||
|
||||
public boolean requestWindowFocus(long time, boolean timeProvided,
|
||||
Runnable lightweigtRequest, Runnable rejectFocusRequest) {
|
||||
focusLog.fine("Request for window focus");
|
||||
// If this is Frame or Dialog we can't assure focus request success - but we still can try
|
||||
// If this is Window and its owner Frame is active we can be sure request succedded.
|
||||
@@ -2057,11 +2079,12 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
|
||||
if (isWMStateNetHidden()) {
|
||||
focusLog.fine("The window is unmapped, so rejecting the request");
|
||||
rejectFocusRequest.run();
|
||||
return false;
|
||||
}
|
||||
if (activeWindow == ownerWindow) {
|
||||
focusLog.fine("Parent window is active - generating focus for this window");
|
||||
handleWindowFocusInSync(-1);
|
||||
handleWindowFocusInSync(-1, lightweigtRequest);
|
||||
return true;
|
||||
}
|
||||
focusLog.fine("Parent window is not active");
|
||||
@@ -2069,9 +2092,11 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
XDecoratedPeer wpeer = AWTAccessor.getComponentAccessor().getPeer(ownerWindow);
|
||||
if (wpeer != null && wpeer.requestWindowFocus(this, time, timeProvided)) {
|
||||
focusLog.fine("Parent window accepted focus request - generating focus for this window");
|
||||
handleWindowFocusInSync(-1, lightweigtRequest);
|
||||
return true;
|
||||
}
|
||||
focusLog.fine("Denied - parent window is not active and didn't accept focus request");
|
||||
rejectFocusRequest.run();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -292,8 +292,4 @@ class NativeStrike extends PhysicalStrike {
|
||||
return new GeneralPath();
|
||||
}
|
||||
|
||||
GlyphRenderData getGlyphRenderData(int glyphCode, float x, float y) {
|
||||
return new GlyphRenderData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class X11TextRenderer extends GlyphListPipe {
|
||||
}
|
||||
}
|
||||
|
||||
native boolean doDrawGlyphList(long dstData, long xgc,
|
||||
native void doDrawGlyphList(long dstData, long xgc,
|
||||
Region clip, GlyphList gl);
|
||||
|
||||
protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) {
|
||||
@@ -78,23 +78,7 @@ public class X11TextRenderer extends GlyphListPipe {
|
||||
long xgc = x11sd.getRenderGC(clip, SunGraphics2D.COMP_ISCOPY,
|
||||
null, sg2d.pixel);
|
||||
gl.startGlyphIteration();
|
||||
boolean allGlyphsRendered = doDrawGlyphList(x11sd.getNativeOps(), xgc, clip, gl);
|
||||
// There are some color glyphs, which we couldn't draw
|
||||
if (!allGlyphsRendered) {
|
||||
gl.startGlyphIteration();
|
||||
for (int i = 0; i < gl.getNumGlyphs(); i++) {
|
||||
if (gl.isColorGlyph(i)) {
|
||||
int end;
|
||||
for (end = i + 1; end < gl.getNumGlyphs(); end++) {
|
||||
if (!gl.isColorGlyph(end)) break;
|
||||
}
|
||||
sg2d.loops.drawGlyphListColorLoop.
|
||||
DrawGlyphListColor(sg2d, sg2d.surfaceData,
|
||||
gl, i, end);
|
||||
i = end - 1;
|
||||
} else gl.setGlyphIndex(i);
|
||||
}
|
||||
}
|
||||
doDrawGlyphList(x11sd.getNativeOps(), xgc, clip, gl);
|
||||
} finally {
|
||||
SunToolkit.awtUnlock();
|
||||
}
|
||||
@@ -105,11 +89,11 @@ public class X11TextRenderer extends GlyphListPipe {
|
||||
}
|
||||
|
||||
public static class Tracer extends X11TextRenderer {
|
||||
boolean doDrawGlyphList(long dstData, long xgc,
|
||||
void doDrawGlyphList(long dstData, long xgc,
|
||||
Region clip, GlyphList gl)
|
||||
{
|
||||
GraphicsPrimitive.tracePrimitive("X11DrawGlyphs");
|
||||
return super.doDrawGlyphList(dstData, xgc, clip, gl);
|
||||
super.doDrawGlyphList(dstData, xgc, clip, gl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ static jboolean checkPixmap(JNIEnv *env, AwtGraphicsConfigDataPtr cData)
|
||||
static void FillBitmap(XImage *theImage,
|
||||
ImageRef *glyphs, jint totalGlyphs,
|
||||
jint clipLeft, jint clipTop,
|
||||
jint clipRight, jint clipBottom, jboolean *allGlyphsRendered)
|
||||
jint clipRight, jint clipBottom)
|
||||
{
|
||||
int glyphCounter;
|
||||
int scan = theImage->bytes_per_line;
|
||||
@@ -124,17 +124,12 @@ static void FillBitmap(XImage *theImage,
|
||||
if (!pixels) {
|
||||
continue;
|
||||
}
|
||||
rowBytes = glyphs[glyphCounter].rowBytes;
|
||||
rowBytes = glyphs[glyphCounter].width;
|
||||
left = glyphs[glyphCounter].x;
|
||||
top = glyphs[glyphCounter].y;
|
||||
width = glyphs[glyphCounter].width;
|
||||
height = glyphs[glyphCounter].height;
|
||||
|
||||
if ((int) rowBytes == width * 4) { // Skip colored glyphs
|
||||
*allGlyphsRendered = JNI_FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* if any clipping required, modify parameters now */
|
||||
right = left + width;
|
||||
bottom = top + height;
|
||||
@@ -211,7 +206,7 @@ static void FillBitmap(XImage *theImage,
|
||||
JNIEXPORT void JNICALL
|
||||
AWTDrawGlyphList(JNIEnv *env, jobject xtr,
|
||||
jlong dstData, jlong gc,
|
||||
SurfaceDataBounds *bounds, ImageRef *glyphs, jint totalGlyphs, jboolean *allGlyphsRendered)
|
||||
SurfaceDataBounds *bounds, ImageRef *glyphs, jint totalGlyphs)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
GC xgc, theGC;
|
||||
@@ -264,7 +259,7 @@ AWTDrawGlyphList(JNIEnv *env, jobject xtr,
|
||||
FillBitmap(theImage,
|
||||
glyphs,
|
||||
totalGlyphs,
|
||||
cx1, cy1, cx2, cy2, allGlyphsRendered);
|
||||
cx1, cy1, cx2, cy2);
|
||||
|
||||
// NOTE: Since we are tiling around by BM_W, BM_H offsets
|
||||
// and thePixmap is BM_W x BM_H, we do not have to move
|
||||
|
||||
@@ -45,7 +45,6 @@ static jmethodID filenameFilterCallbackMethodID = NULL;
|
||||
static jmethodID setFileInternalMethodID = NULL;
|
||||
static jfieldID widgetFieldID = NULL;
|
||||
static jmethodID setWindowMethodID = NULL;
|
||||
static jmethodID onCloseMethodID = NULL;
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_initIDs
|
||||
(JNIEnv *env, jclass cx)
|
||||
@@ -66,9 +65,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_initIDs
|
||||
|
||||
setWindowMethodID = (*env)->GetMethodID(env, cx, "setWindow", "(J)Z");
|
||||
DASSERT(setWindowMethodID != NULL);
|
||||
|
||||
onCloseMethodID = (*env)->GetMethodID(env, cx, "onClose", "()V");
|
||||
DASSERT(onCloseMethodID != NULL);
|
||||
}
|
||||
|
||||
static gboolean filenameFilterCallback(const GtkFileFilterInfo * filter_info, gpointer obj)
|
||||
@@ -95,8 +91,6 @@ static void quit(JNIEnv * env, jobject jpeer, gboolean isSignalHandler)
|
||||
GtkWidget * dialog = (GtkWidget*)jlong_to_ptr(
|
||||
(*env)->GetLongField(env, jpeer, widgetFieldID));
|
||||
|
||||
(*env)->CallVoidMethod(env, jpeer, onCloseMethodID);
|
||||
|
||||
if (dialog != NULL)
|
||||
{
|
||||
// Callbacks from GTK signals are made within the GTK lock
|
||||
@@ -111,6 +105,8 @@ static void quit(JNIEnv * env, jobject jpeer, gboolean isSignalHandler)
|
||||
|
||||
gtk->gtk_main_quit ();
|
||||
|
||||
(*env)->SetLongField(env, jpeer, widgetFieldID, 0);
|
||||
|
||||
if (!isSignalHandler) {
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
@@ -45,14 +45,14 @@
|
||||
JNIEXPORT void JNICALL AWTDrawGlyphList
|
||||
(JNIEnv *env, jobject xtr,
|
||||
jlong dstData, jlong gc,
|
||||
SurfaceDataBounds *bounds, ImageRef *glyphs, jint totalGlyphs, jboolean *allGlyphsRendered);
|
||||
SurfaceDataBounds *bounds, ImageRef *glyphs, jint totalGlyphs);
|
||||
|
||||
/*
|
||||
* Class: sun_font_X11TextRenderer
|
||||
* Method: doDrawGlyphList
|
||||
* Signature: (Lsun/java2d/SurfaceData;Ljava/awt/Rectangle;ILsun/font/GlyphList;J)Z
|
||||
* Signature: (Lsun/java2d/SurfaceData;Ljava/awt/Rectangle;ILsun/font/GlyphList;J)V
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_sun_font_X11TextRenderer_doDrawGlyphList
|
||||
JNIEXPORT void JNICALL Java_sun_font_X11TextRenderer_doDrawGlyphList
|
||||
(JNIEnv *env, jobject xtr,
|
||||
jlong dstData, jlong xgc, jobject clip,
|
||||
jobject glyphlist)
|
||||
@@ -64,15 +64,13 @@ JNIEXPORT jboolean JNICALL Java_sun_font_X11TextRenderer_doDrawGlyphList
|
||||
|
||||
glyphCount = (*env)->GetIntField(env, glyphlist, sunFontIDs.glyphListLen);
|
||||
if ((gbv = setupBlitVector(env, glyphlist, 0, glyphCount)) == NULL) {
|
||||
return JNI_TRUE;
|
||||
return;
|
||||
}
|
||||
if (!RefineBounds(gbv, &bounds)) {
|
||||
free(gbv);
|
||||
return JNI_TRUE;
|
||||
return;
|
||||
}
|
||||
jboolean allGlyphsRendered = JNI_TRUE;
|
||||
AWTDrawGlyphList(env, xtr, dstData, xgc,
|
||||
&bounds, gbv->glyphs, gbv->numGlyphs, &allGlyphsRendered);
|
||||
&bounds, gbv->glyphs, gbv->numGlyphs);
|
||||
free(gbv);
|
||||
return allGlyphsRendered;
|
||||
}
|
||||
|
||||
@@ -62,9 +62,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import javax.swing.JRootPane;
|
||||
import javax.swing.RootPaneContainer;
|
||||
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.DisplayChangedListener;
|
||||
@@ -87,8 +84,6 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
|
||||
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WWindowPeer");
|
||||
private static final PlatformLogger screenLog = PlatformLogger.getLogger("sun.awt.windows.screen.WWindowPeer");
|
||||
|
||||
public static final String WINDOW_CORNER_RADIUS = "apple.awt.windowCornerRadius";
|
||||
|
||||
// we can't use WDialogPeer as blocker may be an instance of WPrintDialogPeer that
|
||||
// extends WWindowPeer, not WDialogPeer
|
||||
private WWindowPeer modalBlocker = null;
|
||||
@@ -259,13 +254,6 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
|
||||
this.isOpaque = true;
|
||||
setOpaque(((Window)target).isOpaque());
|
||||
}
|
||||
|
||||
if (target instanceof RootPaneContainer) {
|
||||
JRootPane rootpane = ((RootPaneContainer)target).getRootPane();
|
||||
if (rootpane != null) {
|
||||
setRoundedCornersImpl(rootpane.getClientProperty(WINDOW_CORNER_RADIUS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
native void createAwtWindow(WComponentPeer parent);
|
||||
@@ -831,35 +819,6 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
|
||||
}
|
||||
}
|
||||
|
||||
// JBR API internals
|
||||
private static void setRoundedCorners(Window window, Object params) {
|
||||
Object peer = AWTAccessor.getComponentAccessor().getPeer(window);
|
||||
if (peer instanceof WWindowPeer) {
|
||||
((WWindowPeer)peer).setRoundedCornersImpl(params);
|
||||
} else if (window instanceof RootPaneContainer) {
|
||||
JRootPane rootpane = ((RootPaneContainer)window).getRootPane();
|
||||
if (rootpane != null) {
|
||||
rootpane.putClientProperty(WINDOW_CORNER_RADIUS, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setRoundedCornersImpl(Object params) {
|
||||
if (params instanceof String) {
|
||||
int type = 0; // default
|
||||
if ("none".equals(params)) {
|
||||
type = 1;
|
||||
} else if ("full".equals(params)) {
|
||||
type = 2;
|
||||
} else if ("small".equals(params)) {
|
||||
type = 3;
|
||||
}
|
||||
setRoundedCorners(type);
|
||||
}
|
||||
}
|
||||
|
||||
private native void setRoundedCorners(int type);
|
||||
|
||||
native void updateWindowImpl(int[] data, int width, int height);
|
||||
|
||||
@Override
|
||||
|
||||
@@ -85,11 +85,6 @@ public class NativeFont extends PhysicalFont {
|
||||
return null;
|
||||
}
|
||||
|
||||
public GlyphRenderData getGlyphRenderData(long pScalerContext, int glyphCode,
|
||||
float x, float y) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
long getGlyphImage(long pScalerContext, int glyphCode) {
|
||||
return 0L;
|
||||
|
||||
@@ -83,8 +83,4 @@ public class NativeStrike extends PhysicalStrike {
|
||||
return null;
|
||||
}
|
||||
|
||||
GlyphRenderData getGlyphRenderData(int glyphCode, float x, float y) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -515,15 +515,7 @@ MsgRouting AwtFrame::WmMouseMove(UINT flags, int x, int y) {
|
||||
* If this Frame is non-focusable then we should implement move and size operation for it by
|
||||
* ourselfves because we don't dispatch appropriate mouse messages to default window procedure.
|
||||
*/
|
||||
if (isInManualMoveOrSize) {
|
||||
if (grabbedHitTest == HTCAPTION) {
|
||||
WINDOWPLACEMENT placement;
|
||||
::GetWindowPlacement(GetHWnd(), &placement);
|
||||
if (placement.showCmd == SW_SHOWMAXIMIZED) {
|
||||
placement.showCmd = SW_SHOWNORMAL;
|
||||
::SetWindowPlacement(GetHWnd(), &placement);
|
||||
}
|
||||
}
|
||||
if (!IsFocusableWindow() && isInManualMoveOrSize) {
|
||||
DWORD curPos = ::GetMessagePos();
|
||||
x = GET_X_LPARAM(curPos);
|
||||
y = GET_Y_LPARAM(curPos);
|
||||
@@ -635,29 +627,10 @@ MsgRouting AwtFrame::WmNcMouseDown(WPARAM hitTest, int x, int y, int button) {
|
||||
// Do not handle events from caption itself to preserve native drag behavior
|
||||
if (HasCustomDecoration()) {
|
||||
switch (hitTest) {
|
||||
case HTCAPTION:
|
||||
case HTMINBUTTON:
|
||||
case HTMAXBUTTON:
|
||||
case HTCLOSE:
|
||||
case HTMENU:
|
||||
RECT rcWindow;
|
||||
GetWindowRect(GetHWnd(), &rcWindow);
|
||||
if (hitTest == HTCAPTION) {
|
||||
JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
jint customSpot = JNU_CallMethodByName(env, NULL, GetTarget(env),
|
||||
"hitTestCustomDecoration", "(II)I",
|
||||
ScaleDownX(x - rcWindow.left),
|
||||
ScaleDownY(y - rcWindow.top)).i;
|
||||
if (customSpot == java_awt_Window_CustomWindowDecoration_DRAGGABLE_AREA) {
|
||||
if (button & LEFT_BUTTON) {
|
||||
savedMousePos.x = x;
|
||||
savedMousePos.y = y;
|
||||
::SetCapture(GetHWnd());
|
||||
isInManualMoveOrSize = TRUE;
|
||||
grabbedHitTest = hitTest;
|
||||
}
|
||||
} else break;
|
||||
}
|
||||
POINT myPos;
|
||||
myPos.x = x;
|
||||
myPos.y = y;
|
||||
@@ -1814,7 +1787,6 @@ LRESULT HitTestNCA(AwtFrame* frame, int x, int y) {
|
||||
frame->ScaleDownY(y - rcWindow.top)).i;
|
||||
switch (customSpot) {
|
||||
case java_awt_Window_CustomWindowDecoration_NO_HIT_SPOT:
|
||||
case java_awt_Window_CustomWindowDecoration_DRAGGABLE_AREA:
|
||||
break; // Nothing
|
||||
case java_awt_Window_CustomWindowDecoration_MINIMIZE_BUTTON:
|
||||
return HTMINBUTTON;
|
||||
|
||||
@@ -46,15 +46,11 @@
|
||||
#include "sun_awt_windows_WCanvasPeer.h"
|
||||
|
||||
#include <windowsx.h>
|
||||
#include <dwmapi.h>
|
||||
#include <math.h>
|
||||
#if !defined(__int3264)
|
||||
typedef __int32 LONG_PTR;
|
||||
#endif // __int3264
|
||||
|
||||
#define DWM_WINDOW_CORNER_PREFERENCE int
|
||||
#define DWMWA_WINDOW_CORNER_PREFERENCE 33
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1800
|
||||
# define ROUND_TO_INT(num) ((int) round(num))
|
||||
#else
|
||||
@@ -135,11 +131,6 @@ struct OpaqueStruct {
|
||||
jobject window;
|
||||
jboolean isOpaque;
|
||||
};
|
||||
// struct for _SetRoundedCorners() method
|
||||
struct RoundedCornersStruct {
|
||||
jobject window;
|
||||
DWM_WINDOW_CORNER_PREFERENCE type;
|
||||
};
|
||||
// struct for _UpdateWindow() method
|
||||
struct UpdateWindowStruct {
|
||||
jobject window;
|
||||
@@ -3363,23 +3354,6 @@ void AwtWindow::_SetOpaque(void* param)
|
||||
delete os;
|
||||
}
|
||||
|
||||
void AwtWindow::_SetRoundedCorners(void *param) {
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
RoundedCornersStruct *rcs = (RoundedCornersStruct *)param;
|
||||
jobject self = rcs->window;
|
||||
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
AwtWindow *window = (AwtWindow *)pData;
|
||||
|
||||
DwmSetWindowAttribute(window->GetHWnd(), DWMWA_WINDOW_CORNER_PREFERENCE, &rcs->type, sizeof(DWM_WINDOW_CORNER_PREFERENCE));
|
||||
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
delete rcs;
|
||||
}
|
||||
|
||||
void AwtWindow::_UpdateWindow(void* param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
@@ -4140,26 +4114,6 @@ Java_sun_awt_windows_WWindowPeer_repositionSecurityWarning(JNIEnv *env,
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_windows_WWindowPeer
|
||||
* Method: setRoundedCorners
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_windows_WWindowPeer_setRoundedCorners(JNIEnv *env, jobject self, jint type)
|
||||
{
|
||||
TRY;
|
||||
|
||||
RoundedCornersStruct *rcs = new RoundedCornersStruct;
|
||||
rcs->window = env->NewGlobalRef(self);
|
||||
rcs->type = (DWM_WINDOW_CORNER_PREFERENCE)type;
|
||||
|
||||
AwtToolkit::GetInstance().SyncCall(AwtWindow::_SetRoundedCorners, rcs);
|
||||
// global refs and rcs are deleted in _SetRoundedCorners
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_windows_WLightweightFramePeer
|
||||
* Method: overrideNativeHandle
|
||||
|
||||
@@ -249,7 +249,6 @@ public:
|
||||
static void _SetFullScreenExclusiveModeState(void* param);
|
||||
static void _GetNativeWindowSize(void* param);
|
||||
static void _OverrideHandle(void *param);
|
||||
static void _SetRoundedCorners(void* param);
|
||||
|
||||
inline static BOOL IsResizing() {
|
||||
return sm_resizing;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2012, 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
|
||||
@@ -49,15 +49,11 @@ jint shmemBase_receivePacket(SharedMemoryConnection *, jdwpPacket *packet);
|
||||
jint shmemBase_name(SharedMemoryTransport *, char **name);
|
||||
jint shmemBase_getlasterror(char *msg, jint size);
|
||||
|
||||
#ifndef SHMEM_BUILD_TIME
|
||||
#define SHMEM_BUILD_TIME __DATE__
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define SHMEM_ASSERT(expression) \
|
||||
do { \
|
||||
if (!(expression)) { \
|
||||
exitTransportWithError("assertion failed", __FILE__, SHMEM_BUILD_TIME, __LINE__); \
|
||||
exitTransportWithError("assertion failed", __FILE__, __DATE__, __LINE__); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
@@ -67,7 +63,7 @@ do { \
|
||||
#define SHMEM_GUARANTEE(expression) \
|
||||
do { \
|
||||
if (!(expression)) { \
|
||||
exitTransportWithError("assertion failed", __FILE__, SHMEM_BUILD_TIME, __LINE__); \
|
||||
exitTransportWithError("assertion failed", __FILE__, __DATE__, __LINE__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2012, 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
|
||||
@@ -39,16 +39,12 @@
|
||||
|
||||
static HANDLE memHandle = NULL;
|
||||
|
||||
#ifndef SHMEM_BUILD_TIME
|
||||
#define SHMEM_BUILD_TIME __DATE__
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define sysAssert(expression) { \
|
||||
if (!(expression)) { \
|
||||
exitTransportWithError \
|
||||
("\"%s\", line %d: assertion failure\n", \
|
||||
__FILE__, SHMEM_BUILD_TIME, __LINE__); \
|
||||
__FILE__, __DATE__, __LINE__); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -24,59 +24,19 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Custom window decoration allows merging of window content with native title bar,
|
||||
* which is usually done by treating title bar as part of client area, but with some
|
||||
* special behavior like dragging or maximizing on double click.
|
||||
* @implNote Behavior is platform-dependent, only macOS and Windows are supported.
|
||||
*/
|
||||
public interface CustomWindowDecoration {
|
||||
|
||||
/*CONST java.awt.Window.*_HIT_SPOT*/
|
||||
/*CONST java.awt.Window.*_BUTTON*/
|
||||
/*CONST java.awt.Window.MENU_BAR*/
|
||||
/*CONST java.awt.Window.DRAGGABLE_AREA*/
|
||||
|
||||
/**
|
||||
* Turn custom decoration on or off, {@link #setCustomDecorationTitleBarHeight(Window, int)}
|
||||
* must be called to configure title bar height.
|
||||
*/
|
||||
void setCustomDecorationEnabled(Window window, boolean enabled);
|
||||
/**
|
||||
* @see #setCustomDecorationEnabled(Window, boolean)
|
||||
*/
|
||||
boolean isCustomDecorationEnabled(Window window);
|
||||
|
||||
/**
|
||||
* Set list of hit test spots for a custom decoration.
|
||||
* Hit test spot is a special area inside custom-decorated title bar.
|
||||
* Each hit spot type has its own (probably platform-specific) behavior:
|
||||
* <ul>
|
||||
* <li>{@link #NO_HIT_SPOT} - default title bar area, can be dragged to move a window, maximizes on double-click</li>
|
||||
* <li>{@link #OTHER_HIT_SPOT} - generic hit spot, window cannot be moved with drag or maximized on double-click</li>
|
||||
* <li>{@link #MINIMIZE_BUTTON} - like {@link #OTHER_HIT_SPOT} but displays tooltip on Windows when hovered</li>
|
||||
* <li>{@link #MAXIMIZE_BUTTON} - like {@link #OTHER_HIT_SPOT} but displays tooltip / snap layout menu on Windows when hovered</li>
|
||||
* <li>{@link #CLOSE_BUTTON} - like {@link #OTHER_HIT_SPOT} but displays tooltip on Windows when hovered</li>
|
||||
* <li>{@link #MENU_BAR} - currently no different from {@link #OTHER_HIT_SPOT}</li>
|
||||
* <li>{@link #DRAGGABLE_AREA} - special type, moves window when dragged, but doesn't maximize on double-click</li>
|
||||
* </ul>
|
||||
* @param spots pairs of hit spot shapes with corresponding types.
|
||||
* @implNote Hit spots are tested in sequence, so in case of overlapping areas, first found wins.
|
||||
*/
|
||||
void setCustomDecorationHitTestSpots(Window window, List<Map.Entry<Shape, Integer>> spots);
|
||||
/**
|
||||
* @see #setCustomDecorationHitTestSpots(Window, List)
|
||||
*/
|
||||
List<Map.Entry<Shape, Integer>> getCustomDecorationHitTestSpots(Window window);
|
||||
|
||||
/**
|
||||
* Set height of custom window decoration, won't take effect until custom decoration
|
||||
* is enabled via {@link #setCustomDecorationEnabled(Window, boolean)}.
|
||||
*/
|
||||
void setCustomDecorationTitleBarHeight(Window window, int height);
|
||||
/**
|
||||
* @see #setCustomDecorationTitleBarHeight(Window, int)
|
||||
*/
|
||||
int getCustomDecorationTitleBarHeight(Window window);
|
||||
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2022 JetBrains s.r.o.
|
||||
* 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.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.jetbrains;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
public interface DesktopActions {
|
||||
|
||||
void setHandler(Handler handler);
|
||||
|
||||
interface Handler {
|
||||
default void open(File file) throws IOException { throw new UnsupportedOperationException(); }
|
||||
default void edit(File file) throws IOException { throw new UnsupportedOperationException(); }
|
||||
default void print(File file) throws IOException { throw new UnsupportedOperationException(); }
|
||||
default void mail(URI mailtoURL) throws IOException { throw new UnsupportedOperationException(); }
|
||||
default void browse(URI uri) throws IOException { throw new UnsupportedOperationException(); }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2022 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.jetbrains;
|
||||
|
||||
import java.awt.Window;
|
||||
|
||||
/**
|
||||
* This manager allows decorate awt Window with rounded corners.
|
||||
* Appearance depends from operating system.
|
||||
*/
|
||||
public interface RoundedCornersManager {
|
||||
/**
|
||||
* @param params for macOS is Float object with radius or
|
||||
* Array with {Float for radius, Integer for border width, java.awt.Color for border color}.
|
||||
*
|
||||
* @param params for Windows 11 is String with values:
|
||||
* "default" - let the system decide whether or not to round window corners,
|
||||
* "none" - never round window corners,
|
||||
* "full" - round the corners if appropriate,
|
||||
* "small" - round the corners if appropriate, with a small radius.
|
||||
*/
|
||||
void setRoundedCorners(Window window, Object params);
|
||||
}
|
||||
@@ -250,11 +250,12 @@ public class Gensrc {
|
||||
}
|
||||
|
||||
private void findInModule(String content) {
|
||||
Pattern servicePattern = compile("(service|proxy|twoWayProxy)\\s*\\(([^,)]+)");
|
||||
Pattern servicePattern = compile("(service|proxy|twoWayProxy)\\s*\\(([^)]+)");
|
||||
Matcher matcher = servicePattern.matcher(content);
|
||||
while (matcher.find()) {
|
||||
String type = matcher.group(1);
|
||||
String interfaceName = extractFromStringLiteral(matcher.group(2));
|
||||
String parameters = matcher.group(2);
|
||||
String interfaceName = extractFromStringLiteral(parameters.substring(0, parameters.indexOf(',')));
|
||||
if (type.equals("service")) services.add(interfaceName);
|
||||
else proxies.add(interfaceName);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
# 2. When only new API is added, or some existing API was @Deprecated - increment MINOR, reset PATCH to 0
|
||||
# 3. For major backwards incompatible API changes - increment MAJOR, reset MINOR and PATCH to 0
|
||||
|
||||
VERSION = 1.1.1
|
||||
VERSION = 0.0.5
|
||||
|
||||
# Hash is used to track changes to jetbrains.api, so you would not forget to update version when needed.
|
||||
# When you make any changes, "make jbr-api" will fail and ask you to update hash and version number here.
|
||||
|
||||
HASH = 80FE49AB3B6461EBB48F9F2FC2A1D45F
|
||||
HASH = 2F4DD7564F018A0AB7CD8DFF010E3B4
|
||||
|
||||
@@ -142,55 +142,4 @@ vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn001/forceEa
|
||||
|
||||
#############################################################################
|
||||
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc1/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc10/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc11/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc12/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc13/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc14/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc15/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc16/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc17/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc18/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc19/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc2/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc20/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc21/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc22/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc23/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc24/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc25/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc26/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc27/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc28/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc29/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc3/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc30/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc31/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc32/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc33/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc34/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc35/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc36/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc37/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc38/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc39/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc4/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc40/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc41/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc42/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc43/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc44/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc45/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc46/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc47/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc48/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc49/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc5/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc50/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc51/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc52/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc6/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc7/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc8/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions/nativeFnc9/TestDescription.java 8271615 macosx-all
|
||||
vmTestbase/vm/jit/LongTransitions 8271615 macosx-all
|
||||
@@ -85,10 +85,6 @@ tier4 = \
|
||||
-:tier2 \
|
||||
-:tier3
|
||||
|
||||
tier4_no_desktop = \
|
||||
:tier4 \
|
||||
-:jdk_desktop
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Other test definitions; generally smaller granularity than tiers
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user